Skip to content

Commit

Permalink
chore(v2): remove deprecated code (#1624)
Browse files Browse the repository at this point in the history
* remove deprecated code

* fix tests

* fix tests

* remove v1 workflows

* remove sqs example in doc
  • Loading branch information
jeromevdl authored Jul 3, 2024
1 parent b4f9ee9 commit 749e973
Show file tree
Hide file tree
Showing 20 changed files with 78 additions and 346 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Build Docs
on:
pull_request:
branches:
- main
- v2
paths:
- 'docs/**'
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/pr_artifacts_size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ name: Artifacts Size
on:
pull_request:
branches:
- main
- v2
paths:
- 'powertools-batch/**'
- 'powertools-cloudformation/**'
- 'powertools-core/**' # not in v2
- 'powertools-common/**' # v2 only
- 'powertools-common/**'
- 'powertools-e2e-tests/**'
- 'powertools-idempotency-core/**'
- 'powertools-idempotency-dynamodb/**'
Expand All @@ -18,8 +16,6 @@ on:
- 'powertools-metrics/**'
- 'powertools-parameters/**'
- 'powertools-serialization/**'
- 'powertools-sqs/**' # not in v2
- 'powertools-test-suite/**' # not in v2
- 'powertools-tracing/**'
- 'powertools-validation/**'
- 'pom.xml'
Expand Down
18 changes: 6 additions & 12 deletions .github/workflows/pr_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,18 @@ name: Build
on:
pull_request:
branches:
- main
- v2
paths:
- 'powertools-batch/**'
- 'powertools-cloudformation/**'
- 'powertools-core/**'
- 'powertools-common/**'
- 'powertools-e2e-tests/**'
- 'powertools-idempotency/**'
- 'powertools-large-messages/**'
- 'powertools-logging/**'
- 'powertools-metrics/**'
- 'powertools-parameters/**'
- 'powertools-serialization/**'
- 'powertools-sqs/**'
- 'powertools-test-suite/**'
- 'powertools-tracing/**'
- 'powertools-validation/**'
- 'examples/**'
Expand All @@ -25,20 +23,18 @@ on:
- '.github/workflows/**'
push:
branches:
- main
- v2
paths:
- 'powertools-batch/**'
- 'powertools-cloudformation/**'
- 'powertools-core/**'
- 'powertools-common/**'
- 'powertools-e2e-tests/**'
- 'powertools-idempotency/**'
- 'powertools-large-messages/**'
- 'powertools-logging/**'
- 'powertools-metrics/**'
- 'powertools-parameters/**'
- 'powertools-serialization/**'
- 'powertools-sqs/**'
- 'powertools-test-suite/**'
- 'powertools-tracing/**'
- 'powertools-validation/**'
- 'examples/**'
Expand Down Expand Up @@ -70,12 +66,10 @@ jobs:
- name: Build with Maven
run: mvn -B install --file pom.xml
- name: Build Gradle Example - Java
if: ${{ matrix.java == '8' }} # Gradle example can only be built on Java 8
working-directory: examples/powertools-examples-core/gradle
working-directory: examples/powertools-examples-core-utilities/gradle
run: ./gradlew build
- name: Build Gradle Example - Kotlin
if: ${{ matrix.java == '8' }} # Gradle example can only be built on Java 8
working-directory: examples/powertools-examples-core/kotlin
working-directory: examples/powertools-examples-core-utilities/kotlin
run: ./gradlew build
- name: Upload coverage to Codecov
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
Expand Down
93 changes: 0 additions & 93 deletions .github/workflows/pr_build_v2.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .github/workflows/pr_iac_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ name: Validate IaC
on:
push:
branches:
- main
- v2
pull_request:
branches:
- main
- v2
paths:
- 'examples/**'
Expand Down
58 changes: 0 additions & 58 deletions .github/workflows/run-e2e-tests-v2.yml

This file was deleted.

8 changes: 3 additions & 5 deletions .github/workflows/run-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

push:
branches:
- main
- v2
paths: # add other modules when there are under e2e tests
- 'powertools-e2e-tests/**'
- 'powertools-batch/**'
Expand All @@ -23,7 +23,7 @@ on:

pull_request:
branches:
- main
- v2
paths:
- 'powertools-e2e-tests/**'

Expand Down Expand Up @@ -54,7 +54,5 @@ jobs:
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN_TO_ASSUME }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: Build with Maven
run: mvn -DskipTests install --file pom.xml
- name: Run e2e test with Maven
run: mvn -Pe2e -B verify --file powertools-e2e-tests/pom.xml
run: mvn -DskipTests install --file pom.xml && mvn -Pe2e -B verify --file powertools-e2e-tests/pom.xml
1 change: 0 additions & 1 deletion .github/workflows/spotbugs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: SpotBugs
on:
pull_request:
branches:
- main
- v2
paths:
- 'powertools-cloudformation/**'
Expand Down
1 change: 0 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Each example can be copied from its subdirectory and used independently of the r
* [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
* [powertools-examples-sqs](powertools-examples-sqs) - Processes SQS batch requests (**Deprecated** - will be replaced by `powertools-examples-batch` in version 2 of this library)
* [powertools-examples-validation](powertools-examples-validation) - Uses the validation module to validate user requests received via API Gateway
* [powertools-examples-cloudformation](powertools-examples-cloudformation) - Deploys a Cloudformation custom resource
* [powertools-examples-batch](powertools-examples-batch) - Examples for each of the different batch processing deployments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,6 @@ public static Builder builder() {
return new Builder();
}

/**
* Creates a failed Response with no physicalResourceId set. Powertools for AWS Lambda (Java) will set the physicalResourceId to the
* Lambda LogStreamName
* <p>
* The value returned for a PhysicalResourceId can change custom resource update operations. If the value returned
* is the same, it is considered a normal update. If the value returned is different, AWS CloudFormation recognizes
* the update as a replacement and sends a delete request to the old resource. For more information,
* see AWS::CloudFormation::CustomResource.
*
* @return a failed Response with no value.
* @deprecated this method is not safe. Provide a physicalResourceId.
*/
@Deprecated
public static Response failed() {
return new Response(null, Status.FAILED, null, false);
}

/**
* Creates a failed Response with a given physicalResourceId.
*
Expand All @@ -80,23 +63,6 @@ public static Response failed(String physicalResourceId) {
return new Response(null, Status.FAILED, physicalResourceId, false);
}

/**
* Creates a successful Response with no physicalResourceId set. Powertools for AWS Lambda (Java) will set the physicalResourceId to the
* Lambda LogStreamName
* <p>
* The value returned for a PhysicalResourceId can change custom resource update operations. If the value returned
* is the same, it is considered a normal update. If the value returned is different, AWS CloudFormation recognizes
* the update as a replacement and sends a delete request to the old resource. For more information,
* see AWS::CloudFormation::CustomResource.
*
* @return a success Response with no physicalResourceId value.
* @deprecated this method is not safe. Provide a physicalResourceId.
*/
@Deprecated
public static Response success() {
return new Response(null, Status.SUCCESS, null, false);
}

/**
* Creates a successful Response with a given physicalResourceId.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import software.amazon.awssdk.utils.StringInputStream;
import software.amazon.lambda.powertools.cloudformation.CloudFormationResponse.ResponseBody;

public class CloudFormationResponseTest {
class CloudFormationResponseTest {

/**
* Creates a mock CloudFormationCustomResourceEvent with a non-null response URL.
Expand Down Expand Up @@ -215,7 +215,7 @@ void reasonIncludesLogStreamName() {
}

@Test
public void sendWithNoResponseData() throws Exception {
void sendWithNoResponseData() throws Exception {
CloudFormationCustomResourceEvent event = mockCloudFormationCustomResourceEvent();
Context context = mock(Context.class);
CloudFormationResponse cfnResponse = testableCloudFormationResponse();
Expand All @@ -237,7 +237,7 @@ public void sendWithNoResponseData() throws Exception {
}

@Test
public void sendWithNonNullResponseData() throws Exception {
void sendWithNonNullResponseData() throws Exception {
CloudFormationCustomResourceEvent event = mockCloudFormationCustomResourceEvent();
Context context = mock(Context.class);
CloudFormationResponse cfnResponse = testableCloudFormationResponse();
Expand Down Expand Up @@ -289,7 +289,7 @@ void responseBodyStreamSuccessResponse() throws Exception {
Context context = mock(Context.class);
CloudFormationResponse cfnResponse = testableCloudFormationResponse();

StringInputStream stream = cfnResponse.responseBodyStream(event, context, Response.success());
StringInputStream stream = cfnResponse.responseBodyStream(event, context, Response.success(null));

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

StringInputStream stream = cfnResponse.responseBodyStream(event, context, Response.failed());
StringInputStream stream = cfnResponse.responseBodyStream(event, context, Response.failed(null));

String expectedJson = "{" +
"\"Status\":\"FAILED\"," +
Expand Down
Loading

0 comments on commit 749e973

Please sign in to comment.