Skip to content

Commit 5e08737

Browse files
committed
Merge branch '4.9.x' into 5.0.x
2 parents bb8410b + 263e52e commit 5e08737

File tree

80 files changed

+1467
-217
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1467
-217
lines changed

.github/renovate.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,15 @@
1212
"packageRules": [
1313
{
1414
"matchPackagePatterns": ["actions.*"],
15-
"dependencyDashboardApproval": true
15+
"dependencyDashboardApproval": true,
16+
"matchUpdateTypes": ["patch"],
17+
"matchCurrentVersion": "!/^0/",
18+
"automerge": true
19+
},
20+
{
21+
"matchUpdateTypes": ["patch"],
22+
"matchCurrentVersion": "!/^0/",
23+
"automerge": true
1624
}
1725
]
1826
}

.github/workflows/central-sync.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
uses: actions/checkout@v4
1919
with:
2020
ref: v${{ github.event.inputs.release_version }}
21-
- uses: gradle/wrapper-validation-action@v2
21+
- uses: gradle/wrapper-validation-action@v3
2222
- name: Set up JDK
2323
uses: actions/setup-java@v4
2424
with:

.github/workflows/gradle.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ jobs:
4545
fetch-depth: 0
4646

4747
- name: "🔧 Setup GraalVM CE"
48-
uses: graalvm/[email protected].1
48+
uses: graalvm/[email protected].6
4949
with:
5050
distribution: 'graalvm'
5151
java-version: ${{ matrix.java }}
5252
github-token: ${{ secrets.GITHUB_TOKEN }}
5353

5454
- name: "🔧 Setup Gradle"
55-
uses: gradle/gradle-build-action@v3.1.0
55+
uses: gradle/gradle-build-action@v3.5.0
5656

5757
- name: "❓ Optional setup step"
5858
run: |
@@ -70,15 +70,15 @@ jobs:
7070
7171
- name: "📊 Publish Test Report"
7272
if: always()
73-
uses: mikepenz/action-junit-report@v4
73+
uses: mikepenz/action-junit-report@v5
7474
with:
7575
check_name: Java CI / Test Report (${{ matrix.java }})
7676
report_paths: '**/build/test-results/test/TEST-*.xml'
7777
check_retries: 'true'
7878

7979
- name: "📜 Upload binary compatibility check results"
8080
if: matrix.java == '17'
81-
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
81+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
8282
with:
8383
name: binary-compatibility-reports
8484
path: "**/build/reports/binary-compatibility-*.html"

.github/workflows/release.yml

+8-10
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
uses: actions/checkout@v4
1818
with:
1919
token: ${{ secrets.GH_TOKEN }}
20-
- uses: gradle/wrapper-validation-action@v2
20+
- uses: gradle/wrapper-validation-action@v3
2121
- name: Set up JDK
2222
uses: actions/setup-java@v4
2323
with:
@@ -66,13 +66,13 @@ jobs:
6666
# Store the hash in a file, which is uploaded as a workflow artifact.
6767
sha256sum $ARTIFACTS | base64 -w0 > artifacts-sha256
6868
- name: Upload build artifacts
69-
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
69+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
7070
with:
7171
name: gradle-build-outputs
7272
path: build/repo/${{ steps.publish.outputs.group }}/*/${{ steps.publish.outputs.version }}/*
7373
retention-days: 5
7474
- name: Upload artifacts-sha256
75-
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
75+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
7676
with:
7777
name: artifacts-sha256
7878
path: artifacts-sha256
@@ -115,7 +115,7 @@ jobs:
115115
artifacts-sha256: ${{ steps.set-hash.outputs.artifacts-sha256 }}
116116
steps:
117117
- name: Download artifacts-sha256
118-
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
118+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
119119
with:
120120
name: artifacts-sha256
121121
# The SLSA provenance generator expects the hash digest of artifacts to be passed as a job
@@ -134,7 +134,7 @@ jobs:
134134
actions: read # To read the workflow path.
135135
id-token: write # To sign the provenance.
136136
contents: write # To add assets to a release.
137-
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.10.0
137+
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0
138138
with:
139139
base64-subjects: "${{ needs.provenance-subject.outputs.artifacts-sha256 }}"
140140
upload-assets: true # Upload to a new release.
@@ -146,11 +146,9 @@ jobs:
146146
if: startsWith(github.ref, 'refs/tags/')
147147
steps:
148148
- name: Checkout repository
149-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
149+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
150150
- name: Download artifacts
151-
# Important: update actions/download-artifact to v4 only when generator_generic_slsa3.yml is also compatible.
152-
# See https://github.com/slsa-framework/slsa-github-generator/issues/3068
153-
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
151+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
154152
with:
155153
name: gradle-build-outputs
156154
path: build/repo
@@ -162,6 +160,6 @@ jobs:
162160
- name: Upload assets
163161
# Upload the artifacts to the existing release. Note that the SLSA provenance will
164162
# attest to each artifact file and not the aggregated ZIP file.
165-
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
163+
uses: softprops/action-gh-release@7b4da11513bf3f43f9999e90eabced41ab8bb048 # v2.2.0
166164
with:
167165
files: artifacts.zip

aws-lambda-events-serde/src/main/java/io/micronaut/aws/lambda/events/serde/S3ObjectEntitySerde.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import java.io.IOException;
3333

3434
/**
35-
* This seems to be necessary because Serde was not picking the appropriate constructor {@link com.amazonaws.services.lambda.runtime.events.models.s3.S3EventNotification.S3ObjectEntity(String, Long, String, String, String)}.
35+
* This seems to be necessary because Serde was not picking the appropriate constructor {@code S3EventNotification.S3ObjectEntity(String, Long, String, String, String)}.
3636
*/
3737
@Internal
3838
@Singleton

aws-sdk-v2/build.gradle.kts

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ dependencies {
2424
compileOnly(libs.awssdk.secretsmanager)
2525
compileOnly(libs.awssdk.servicediscovery)
2626
compileOnly(libs.awssdk.cloudwatchlogs)
27+
compileOnly(libs.awssdk.lambda)
2728

2829
// Tests
2930
testAnnotationProcessor(mn.micronaut.inject.java)
@@ -41,6 +42,7 @@ dependencies {
4142
testImplementation(libs.awssdk.sqs)
4243
testImplementation(libs.awssdk.ssm)
4344
testImplementation(libs.awssdk.rekognition)
45+
testImplementation(libs.awssdk.lambda)
4446
testRuntimeOnly(libs.jcl.over.slf4j)
4547

4648
testRuntimeOnly(mn.snakeyaml)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/*
2+
* Copyright 2017-2024 original authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.micronaut.aws.sdk.v2.service.lambda;
17+
18+
import io.micronaut.aws.sdk.v2.service.AWSServiceConfiguration;
19+
import io.micronaut.aws.sdk.v2.service.AwsClientFactory;
20+
import io.micronaut.aws.ua.UserAgentProvider;
21+
import io.micronaut.context.annotation.Bean;
22+
import io.micronaut.context.annotation.Factory;
23+
import io.micronaut.context.annotation.Requires;
24+
import io.micronaut.core.annotation.Nullable;
25+
import jakarta.inject.Named;
26+
import jakarta.inject.Singleton;
27+
import software.amazon.awssdk.auth.credentials.AwsCredentialsProviderChain;
28+
import software.amazon.awssdk.http.SdkHttpClient;
29+
import software.amazon.awssdk.http.async.SdkAsyncHttpClient;
30+
import software.amazon.awssdk.regions.providers.AwsRegionProviderChain;
31+
import software.amazon.awssdk.services.lambda.LambdaAsyncClient;
32+
import software.amazon.awssdk.services.lambda.LambdaAsyncClientBuilder;
33+
import software.amazon.awssdk.services.lambda.LambdaClient;
34+
import software.amazon.awssdk.services.lambda.LambdaClientBuilder;
35+
36+
/**
37+
* Factory that creates {@link LambdaClient} and {@link LambdaAsyncClient}.
38+
* @since 4.7.0
39+
*/
40+
@Factory
41+
class LambdaClientFactory extends AwsClientFactory<LambdaClientBuilder, LambdaAsyncClientBuilder, LambdaClient, LambdaAsyncClient> {
42+
/**
43+
* Constructor.
44+
*
45+
* @param credentialsProvider The credentials provider
46+
* @param regionProvider The region provider
47+
* @param userAgentProvider User-Agent Provider
48+
* @param awsServiceConfiguration AWS Service Configuration
49+
*/
50+
protected LambdaClientFactory(AwsCredentialsProviderChain credentialsProvider,
51+
AwsRegionProviderChain regionProvider,
52+
@Nullable UserAgentProvider userAgentProvider,
53+
@Nullable @Named(LambdaClient.SERVICE_NAME) AWSServiceConfiguration awsServiceConfiguration) {
54+
super(credentialsProvider, regionProvider, userAgentProvider, awsServiceConfiguration);
55+
}
56+
57+
@Override
58+
protected LambdaClientBuilder createSyncBuilder() {
59+
return LambdaClient.builder();
60+
}
61+
62+
@Override
63+
protected LambdaAsyncClientBuilder createAsyncBuilder() {
64+
return LambdaAsyncClient.builder();
65+
}
66+
67+
@Override
68+
@Singleton
69+
public LambdaClientBuilder syncBuilder(SdkHttpClient httpClient) {
70+
return super.syncBuilder(httpClient);
71+
}
72+
73+
@Override
74+
@Bean(preDestroy = "close")
75+
@Singleton
76+
public LambdaClient syncClient(LambdaClientBuilder builder) {
77+
return super.syncClient(builder);
78+
}
79+
80+
@Override
81+
@Singleton
82+
@Requires(beans = SdkAsyncHttpClient.class)
83+
public LambdaAsyncClientBuilder asyncBuilder(SdkAsyncHttpClient httpClient) {
84+
return super.asyncBuilder(httpClient);
85+
}
86+
87+
@Override
88+
@Bean(preDestroy = "close")
89+
@Singleton
90+
@Requires(beans = SdkAsyncHttpClient.class)
91+
public LambdaAsyncClient asyncClient(LambdaAsyncClientBuilder builder) {
92+
return super.asyncClient(builder);
93+
}
94+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright 2017-2024 original authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
/**
17+
* Lambda client factory.
18+
* @author Luis Duarte
19+
* @since 4.7.0
20+
*/
21+
@Requires(classes = {LambdaClient.class, LambdaAsyncClient.class})
22+
@Configuration
23+
package io.micronaut.aws.sdk.v2.service.lambda;
24+
25+
import io.micronaut.context.annotation.Configuration;
26+
import io.micronaut.context.annotation.Requires;
27+
import software.amazon.awssdk.services.lambda.LambdaAsyncClient;
28+
import software.amazon.awssdk.services.lambda.LambdaClient;

aws-sdk-v2/src/main/resources/META-INF/native-image/io.micronaut.aws/micronaut-aws-sdk-v2/native-image.properties

-17
This file was deleted.

aws-sdk-v2/src/test/groovy/io/micronaut/aws/sdk/v2/client/NettyClientSpec.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class NettyClientSpec extends ApplicationContextSpecification {
1919

2020
then:
2121
client.configuration().maxConnections() == 123
22-
client.pools.proxyConfiguration == null
22+
client.pools.proxyConfiguration
2323
}
2424

2525
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package io.micronaut.aws.sdk.v2.service
2+
3+
import software.amazon.awssdk.services.lambda.LambdaAsyncClient
4+
import software.amazon.awssdk.services.lambda.LambdaClient
5+
6+
class LambdaClientSpec extends ServiceClientSpec<LambdaClient, LambdaAsyncClient> {
7+
@Override
8+
protected String serviceName() {
9+
return LambdaClient.SERVICE_NAME
10+
}
11+
12+
@Override
13+
protected LambdaClient getClient() {
14+
applicationContext.getBean(LambdaClient)
15+
}
16+
17+
protected LambdaAsyncClient getAsyncClient() {
18+
applicationContext.getBean(LambdaAsyncClient)
19+
}
20+
}

function-aws-api-proxy-test/src/main/java/io/micronaut/function/aws/proxy/test/AwsApiProxyTestServer.java

+1-7
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,7 @@ ApplicationContext getApplicationContext() {
191191
@Override
192192
public void destroy() {
193193
super.destroy();
194-
try {
195-
this.lambdaHandler.close();
196-
} catch (IOException e) {
197-
if (LOG.isErrorEnabled()) {
198-
LOG.error("could not close Handler", e);
199-
}
200-
}
194+
this.lambdaHandler.close();
201195
}
202196

203197
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException {

function-aws-api-proxy-test/src/main/java/io/micronaut/function/aws/proxy/test/DefaultServletToAwsProxyRequestAdapter.java

+12-9
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public class DefaultServletToAwsProxyRequestAdapter implements ServletToAwsProxy
4848
public APIGatewayV2HTTPEvent createAwsProxyRequest(@NonNull HttpServletRequest request) {
4949
final boolean isBase64Encoded = true;
5050
return new APIGatewayV2HTTPEvent() {
51+
private String body;
5152

5253
@Override
5354
public Map<String, String> getHeaders() {
@@ -116,18 +117,20 @@ public boolean getIsBase64Encoded() {
116117

117118
@Override
118119
public String getBody() {
119-
HttpMethod httpMethod = HttpMethod.parse(request.getMethod());
120-
if (HttpMethod.permitsRequestBody(httpMethod)) {
121-
try (InputStream requestBody = request.getInputStream()) {
122-
byte[] data = requestBody.readAllBytes();
123-
if (isBase64Encoded) {
124-
return Base64.getEncoder().encodeToString(data);
120+
if (body == null) {
121+
HttpMethod httpMethod = HttpMethod.parse(request.getMethod());
122+
if (HttpMethod.permitsRequestBody(httpMethod)) {
123+
try (InputStream requestBody = request.getInputStream()) {
124+
byte[] data = requestBody.readAllBytes();
125+
if (isBase64Encoded) {
126+
body = Base64.getEncoder().encodeToString(data);
127+
}
128+
} catch (IOException e) {
129+
// ignore
125130
}
126-
} catch (IOException e) {
127-
// ignore
128131
}
129132
}
130-
return null;
133+
return body;
131134
}
132135
};
133136
}

0 commit comments

Comments
 (0)