Skip to content

Commit 749e973

Browse files
authored
chore(v2): remove deprecated code (#1624)
* remove deprecated code * fix tests * fix tests * remove v1 workflows * remove sqs example in doc
1 parent b4f9ee9 commit 749e973

File tree

20 files changed

+78
-346
lines changed

20 files changed

+78
-346
lines changed

.github/workflows/build-docs.yml

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: Build Docs
33
on:
44
pull_request:
55
branches:
6-
- main
76
- v2
87
paths:
98
- 'docs/**'

.github/workflows/pr_artifacts_size.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ name: Artifacts Size
33
on:
44
pull_request:
55
branches:
6-
- main
76
- v2
87
paths:
98
- 'powertools-batch/**'
109
- 'powertools-cloudformation/**'
11-
- 'powertools-core/**' # not in v2
12-
- 'powertools-common/**' # v2 only
10+
- 'powertools-common/**'
1311
- 'powertools-e2e-tests/**'
1412
- 'powertools-idempotency-core/**'
1513
- 'powertools-idempotency-dynamodb/**'
@@ -18,8 +16,6 @@ on:
1816
- 'powertools-metrics/**'
1917
- 'powertools-parameters/**'
2018
- 'powertools-serialization/**'
21-
- 'powertools-sqs/**' # not in v2
22-
- 'powertools-test-suite/**' # not in v2
2319
- 'powertools-tracing/**'
2420
- 'powertools-validation/**'
2521
- 'pom.xml'

.github/workflows/pr_build.yml

+6-12
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,18 @@ name: Build
33
on:
44
pull_request:
55
branches:
6-
- main
6+
- v2
77
paths:
88
- 'powertools-batch/**'
99
- 'powertools-cloudformation/**'
10-
- 'powertools-core/**'
10+
- 'powertools-common/**'
1111
- 'powertools-e2e-tests/**'
1212
- 'powertools-idempotency/**'
1313
- 'powertools-large-messages/**'
1414
- 'powertools-logging/**'
1515
- 'powertools-metrics/**'
1616
- 'powertools-parameters/**'
1717
- 'powertools-serialization/**'
18-
- 'powertools-sqs/**'
19-
- 'powertools-test-suite/**'
2018
- 'powertools-tracing/**'
2119
- 'powertools-validation/**'
2220
- 'examples/**'
@@ -25,20 +23,18 @@ on:
2523
- '.github/workflows/**'
2624
push:
2725
branches:
28-
- main
26+
- v2
2927
paths:
3028
- 'powertools-batch/**'
3129
- 'powertools-cloudformation/**'
32-
- 'powertools-core/**'
30+
- 'powertools-common/**'
3331
- 'powertools-e2e-tests/**'
3432
- 'powertools-idempotency/**'
3533
- 'powertools-large-messages/**'
3634
- 'powertools-logging/**'
3735
- 'powertools-metrics/**'
3836
- 'powertools-parameters/**'
3937
- 'powertools-serialization/**'
40-
- 'powertools-sqs/**'
41-
- 'powertools-test-suite/**'
4238
- 'powertools-tracing/**'
4339
- 'powertools-validation/**'
4440
- 'examples/**'
@@ -70,12 +66,10 @@ jobs:
7066
- name: Build with Maven
7167
run: mvn -B install --file pom.xml
7268
- name: Build Gradle Example - Java
73-
if: ${{ matrix.java == '8' }} # Gradle example can only be built on Java 8
74-
working-directory: examples/powertools-examples-core/gradle
69+
working-directory: examples/powertools-examples-core-utilities/gradle
7570
run: ./gradlew build
7671
- name: Build Gradle Example - Kotlin
77-
if: ${{ matrix.java == '8' }} # Gradle example can only be built on Java 8
78-
working-directory: examples/powertools-examples-core/kotlin
72+
working-directory: examples/powertools-examples-core-utilities/kotlin
7973
run: ./gradlew build
8074
- name: Upload coverage to Codecov
8175
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1

.github/workflows/pr_build_v2.yml

-93
This file was deleted.

.github/workflows/pr_iac_lint.yml

-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ name: Validate IaC
33
on:
44
push:
55
branches:
6-
- main
76
- v2
87
pull_request:
98
branches:
10-
- main
119
- v2
1210
paths:
1311
- 'examples/**'

.github/workflows/run-e2e-tests-v2.yml

-58
This file was deleted.

.github/workflows/run-e2e-tests.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55

66
push:
77
branches:
8-
- main
8+
- v2
99
paths: # add other modules when there are under e2e tests
1010
- 'powertools-e2e-tests/**'
1111
- 'powertools-batch/**'
@@ -23,7 +23,7 @@ on:
2323

2424
pull_request:
2525
branches:
26-
- main
26+
- v2
2727
paths:
2828
- 'powertools-e2e-tests/**'
2929

@@ -54,7 +54,5 @@ jobs:
5454
with:
5555
role-to-assume: ${{ secrets.AWS_ROLE_ARN_TO_ASSUME }}
5656
aws-region: ${{ env.AWS_DEFAULT_REGION }}
57-
- name: Build with Maven
58-
run: mvn -DskipTests install --file pom.xml
5957
- name: Run e2e test with Maven
60-
run: mvn -Pe2e -B verify --file powertools-e2e-tests/pom.xml
58+
run: mvn -DskipTests install --file pom.xml && mvn -Pe2e -B verify --file powertools-e2e-tests/pom.xml

.github/workflows/spotbugs.yml

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: SpotBugs
33
on:
44
pull_request:
55
branches:
6-
- main
76
- v2
87
paths:
98
- 'powertools-cloudformation/**'

examples/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Each example can be copied from its subdirectory and used independently of the r
1414
* [powertools-examples-idempotency](powertools-examples-idempotency) - An idempotent HTTP API
1515
* [powertools-examples-parameters](powertools-examples-parameters) - Uses the parameters module to provide runtime parameters to a function
1616
* [powertools-examples-serialization](powertools-examples-serialization) - Uses the serialization module to serialize and deserialize API Gateway & SQS payloads
17-
* [powertools-examples-sqs](powertools-examples-sqs) - Processes SQS batch requests (**Deprecated** - will be replaced by `powertools-examples-batch` in version 2 of this library)
1817
* [powertools-examples-validation](powertools-examples-validation) - Uses the validation module to validate user requests received via API Gateway
1918
* [powertools-examples-cloudformation](powertools-examples-cloudformation) - Deploys a Cloudformation custom resource
2019
* [powertools-examples-batch](powertools-examples-batch) - Examples for each of the different batch processing deployments

powertools-cloudformation/src/main/java/software/amazon/lambda/powertools/cloudformation/Response.java

-34
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,6 @@ public static Builder builder() {
4747
return new Builder();
4848
}
4949

50-
/**
51-
* Creates a failed Response with no physicalResourceId set. Powertools for AWS Lambda (Java) will set the physicalResourceId to the
52-
* Lambda LogStreamName
53-
* <p>
54-
* The value returned for a PhysicalResourceId can change custom resource update operations. If the value returned
55-
* is the same, it is considered a normal update. If the value returned is different, AWS CloudFormation recognizes
56-
* the update as a replacement and sends a delete request to the old resource. For more information,
57-
* see AWS::CloudFormation::CustomResource.
58-
*
59-
* @return a failed Response with no value.
60-
* @deprecated this method is not safe. Provide a physicalResourceId.
61-
*/
62-
@Deprecated
63-
public static Response failed() {
64-
return new Response(null, Status.FAILED, null, false);
65-
}
66-
6750
/**
6851
* Creates a failed Response with a given physicalResourceId.
6952
*
@@ -80,23 +63,6 @@ public static Response failed(String physicalResourceId) {
8063
return new Response(null, Status.FAILED, physicalResourceId, false);
8164
}
8265

83-
/**
84-
* Creates a successful Response with no physicalResourceId set. Powertools for AWS Lambda (Java) will set the physicalResourceId to the
85-
* Lambda LogStreamName
86-
* <p>
87-
* The value returned for a PhysicalResourceId can change custom resource update operations. If the value returned
88-
* is the same, it is considered a normal update. If the value returned is different, AWS CloudFormation recognizes
89-
* the update as a replacement and sends a delete request to the old resource. For more information,
90-
* see AWS::CloudFormation::CustomResource.
91-
*
92-
* @return a success Response with no physicalResourceId value.
93-
* @deprecated this method is not safe. Provide a physicalResourceId.
94-
*/
95-
@Deprecated
96-
public static Response success() {
97-
return new Response(null, Status.SUCCESS, null, false);
98-
}
99-
10066
/**
10167
* Creates a successful Response with a given physicalResourceId.
10268
*

powertools-cloudformation/src/test/java/software/amazon/lambda/powertools/cloudformation/CloudFormationResponseTest.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import software.amazon.awssdk.utils.StringInputStream;
3939
import software.amazon.lambda.powertools.cloudformation.CloudFormationResponse.ResponseBody;
4040

41-
public class CloudFormationResponseTest {
41+
class CloudFormationResponseTest {
4242

4343
/**
4444
* Creates a mock CloudFormationCustomResourceEvent with a non-null response URL.
@@ -215,7 +215,7 @@ void reasonIncludesLogStreamName() {
215215
}
216216

217217
@Test
218-
public void sendWithNoResponseData() throws Exception {
218+
void sendWithNoResponseData() throws Exception {
219219
CloudFormationCustomResourceEvent event = mockCloudFormationCustomResourceEvent();
220220
Context context = mock(Context.class);
221221
CloudFormationResponse cfnResponse = testableCloudFormationResponse();
@@ -237,7 +237,7 @@ public void sendWithNoResponseData() throws Exception {
237237
}
238238

239239
@Test
240-
public void sendWithNonNullResponseData() throws Exception {
240+
void sendWithNonNullResponseData() throws Exception {
241241
CloudFormationCustomResourceEvent event = mockCloudFormationCustomResourceEvent();
242242
Context context = mock(Context.class);
243243
CloudFormationResponse cfnResponse = testableCloudFormationResponse();
@@ -289,7 +289,7 @@ void responseBodyStreamSuccessResponse() throws Exception {
289289
Context context = mock(Context.class);
290290
CloudFormationResponse cfnResponse = testableCloudFormationResponse();
291291

292-
StringInputStream stream = cfnResponse.responseBodyStream(event, context, Response.success());
292+
StringInputStream stream = cfnResponse.responseBodyStream(event, context, Response.success(null));
293293

294294
String expectedJson = "{" +
295295
"\"Status\":\"SUCCESS\"," +
@@ -310,7 +310,7 @@ void responseBodyStreamFailedResponse() throws Exception {
310310
Context context = mock(Context.class);
311311
CloudFormationResponse cfnResponse = testableCloudFormationResponse();
312312

313-
StringInputStream stream = cfnResponse.responseBodyStream(event, context, Response.failed());
313+
StringInputStream stream = cfnResponse.responseBodyStream(event, context, Response.failed(null));
314314

315315
String expectedJson = "{" +
316316
"\"Status\":\"FAILED\"," +

0 commit comments

Comments
 (0)