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 a5186b4b..042a481a 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; @@ -903,6 +905,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 */ @@ -1206,6 +1231,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) @@ -1244,6 +1271,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) @@ -1300,6 +1331,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",