From 0676e55db536fcc8ed8990c2d9fa474277b51f71 Mon Sep 17 00:00:00 2001 From: msailes Date: Tue, 29 Dec 2020 14:55:49 +0000 Subject: [PATCH 1/3] issue 207: Added the version field to the APIGatewayProxyRequestEvent --- .../events/APIGatewayProxyRequestEvent.java | 32 +++++++++++++++++++ .../api_gateway_proxy_request_event.json | 1 + 2 files changed, 33 insertions(+) diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayProxyRequestEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayProxyRequestEvent.java index f9c118ca..68c6c6a1 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayProxyRequestEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayProxyRequestEvent.java @@ -11,6 +11,8 @@ public class APIGatewayProxyRequestEvent implements Serializable, Cloneable { private static final long serialVersionUID = 4189228800688527467L; + private String version; + private String resource; private String path; @@ -871,6 +873,29 @@ public RequestIdentity clone() { */ public APIGatewayProxyRequestEvent() {} + /** + * @return The payload format version + */ + public String getVersion() { + return version; + } + + /** + * @param version The payload format version + */ + public void setVersion(String version) { + this.version = version; + } + + /** + * @param version The payload format version + * @return + */ + public APIGatewayProxyRequestEvent withVersion(String version) { + this.setVersion(version); + return this; + } + /** * @return The resource path defined in API Gateway */ @@ -1174,6 +1199,8 @@ public APIGatewayProxyRequestEvent withIsBase64Encoded(Boolean isBase64Encoded) public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); + if (getVersion() != null) + sb.append("version: ").append(getVersion()).append(","); if (getResource() != null) sb.append("resource: ").append(getResource()).append(","); if (getPath() != null) @@ -1212,6 +1239,10 @@ public boolean equals(Object obj) { if (obj instanceof APIGatewayProxyRequestEvent == false) return false; APIGatewayProxyRequestEvent other = (APIGatewayProxyRequestEvent) obj; + if (other.getVersion() == null ^ this.getVersion() == null) + return false; + if (other.getVersion() != null && other.getVersion().equals(this.getVersion()) == false) + return false; if (other.getResource() == null ^ this.getResource() == null) return false; if (other.getResource() != null && other.getResource().equals(this.getResource()) == false) @@ -1268,6 +1299,7 @@ public int hashCode() { final int prime = 31; int hashCode = 1; + hashCode = prime * hashCode + ((getVersion() == null) ? 0 : getVersion().hashCode()); hashCode = prime * hashCode + ((getResource() == null) ? 0 : getResource().hashCode()); hashCode = prime * hashCode + ((getPath() == null) ? 0 : getPath().hashCode()); hashCode = prime * hashCode + ((getHttpMethod() == null) ? 0 : getHttpMethod().hashCode()); diff --git a/aws-lambda-java-serialization/src/test/resources/event_models/api_gateway_proxy_request_event.json b/aws-lambda-java-serialization/src/test/resources/event_models/api_gateway_proxy_request_event.json index f6113c71..66c5d953 100644 --- a/aws-lambda-java-serialization/src/test/resources/event_models/api_gateway_proxy_request_event.json +++ b/aws-lambda-java-serialization/src/test/resources/event_models/api_gateway_proxy_request_event.json @@ -1,4 +1,5 @@ { + "version": "1.0", "path": "/test/hello", "headers": { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", From fe31548fc1b7006dbc88dfb2bc345c2044095398 Mon Sep 17 00:00:00 2001 From: msailes Date: Fri, 29 Jan 2021 17:35:03 +0000 Subject: [PATCH 2/3] updating the github actions to install the serialization lib for RIC --- .github/workflows/aws-lambda-java-serialization.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/aws-lambda-java-serialization.yml b/.github/workflows/aws-lambda-java-serialization.yml index 72592de8..0eef4883 100644 --- a/.github/workflows/aws-lambda-java-serialization.yml +++ b/.github/workflows/aws-lambda-java-serialization.yml @@ -30,4 +30,4 @@ jobs: run: mvn -B install --file aws-lambda-java-events/pom.xml # Package target module - name: Package serialization with Maven - run: mvn -B package --file aws-lambda-java-serialization/pom.xml + run: mvn -B install --file aws-lambda-java-serialization/pom.xml From 5cfa56d19594ac610a52b0160fdd2873a6e21417 Mon Sep 17 00:00:00 2001 From: msailes Date: Wed, 2 Jun 2021 15:31:27 +0100 Subject: [PATCH 3/3] changed to package --- .github/workflows/aws-lambda-java-serialization.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/aws-lambda-java-serialization.yml b/.github/workflows/aws-lambda-java-serialization.yml index 0eef4883..72592de8 100644 --- a/.github/workflows/aws-lambda-java-serialization.yml +++ b/.github/workflows/aws-lambda-java-serialization.yml @@ -30,4 +30,4 @@ jobs: run: mvn -B install --file aws-lambda-java-events/pom.xml # Package target module - name: Package serialization with Maven - run: mvn -B install --file aws-lambda-java-serialization/pom.xml + run: mvn -B package --file aws-lambda-java-serialization/pom.xml