From 6dea942f1432e4dead255183f403723f7eae51c5 Mon Sep 17 00:00:00 2001 From: Tim Gustafson Date: Tue, 23 Jul 2019 14:44:55 +0200 Subject: [PATCH 1/9] Added request and response objects for APIGatewayV2 --- .../events/APIGatewayV2ProxyRequestEvent.java | 366 ++++++++++++++++++ .../APIGatewayV2ProxyResponseEvent.java | 81 ++++ 2 files changed, 447 insertions(+) create mode 100644 aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java create mode 100644 aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyResponseEvent.java diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java new file mode 100644 index 000000000..3cfcd7453 --- /dev/null +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java @@ -0,0 +1,366 @@ +package com.amazonaws.services.lambda.runtime.events; + +import java.io.Serializable; +import java.util.Objects; + +/** + * @author Tim Gustafson + */ +public class APIGatewayV2ProxyRequestEvent implements Serializable, Cloneable { + + public class RequestIdentity implements Serializable, Cloneable { + + private String sourceIp; + private String userAgent; + + public String getSourceIp() { + return sourceIp; + } + + public void setSourceIp(String sourceIp) { + this.sourceIp = sourceIp; + } + + public String getUserAgent() { + return userAgent; + } + + public void setUserAgent(String userAgent) { + this.userAgent = userAgent; + } + + @Override + public int hashCode() { + int hash = 7; + + hash = 59 * hash + Objects.hashCode(this.sourceIp); + hash = 59 * hash + Objects.hashCode(this.userAgent); + + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + if (obj == null) { + return false; + } + + if (getClass() != obj.getClass()) { + return false; + } + + final RequestIdentity other = (RequestIdentity) obj; + + if (!Objects.equals(this.sourceIp, other.sourceIp)) { + return false; + } + + if (!Objects.equals(this.userAgent, other.userAgent)) { + return false; + } + + return true; + } + + } + + public class RequestContext implements Serializable, Cloneable { + + private String routeKey; + private String messageId; + private String eventType; + private String extendedRequestId; + private String requestTime; + private String messageDirection; + private String stage; + private long connectedAt; + private long requestTimeEpoch; + private RequestIdentity identity; + private String requestId; + private String domainName; + private String connectionId; + private String apiId; + + public String getRouteKey() { + return routeKey; + } + + public void setRouteKey(String routeKey) { + this.routeKey = routeKey; + } + + public String getMessageId() { + return messageId; + } + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + public String getEventType() { + return eventType; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + public String getExtendedRequestId() { + return extendedRequestId; + } + + public void setExtendedRequestId(String extendedRequestId) { + this.extendedRequestId = extendedRequestId; + } + + public String getRequestTime() { + return requestTime; + } + + public void setRequestTime(String requestTime) { + this.requestTime = requestTime; + } + + public String getMessageDirection() { + return messageDirection; + } + + public void setMessageDirection(String messageDirection) { + this.messageDirection = messageDirection; + } + + public String getStage() { + return stage; + } + + public void setStage(String stage) { + this.stage = stage; + } + + public long getConnectedAt() { + return connectedAt; + } + + public void setConnectedAt(long connectedAt) { + this.connectedAt = connectedAt; + } + + public long getRequestTimeEpoch() { + return requestTimeEpoch; + } + + public void setRequestTimeEpoch(long requestTimeEpoch) { + this.requestTimeEpoch = requestTimeEpoch; + } + + public RequestIdentity getIdentity() { + return identity; + } + + public void setIdentity(RequestIdentity identity) { + this.identity = identity; + } + + public String getRequestId() { + return requestId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + public String getDomainName() { + return domainName; + } + + public void setDomainName(String domainName) { + this.domainName = domainName; + } + + public String getConnectionId() { + return connectionId; + } + + public void setConnectionId(String connectionId) { + this.connectionId = connectionId; + } + + public String getApiId() { + return apiId; + } + + public void setApiId(String apiId) { + this.apiId = apiId; + } + + @Override + public int hashCode() { + int hash = 7; + + hash = 41 * hash + Objects.hashCode(this.routeKey); + hash = 41 * hash + Objects.hashCode(this.messageId); + hash = 41 * hash + Objects.hashCode(this.eventType); + hash = 41 * hash + Objects.hashCode(this.extendedRequestId); + hash = 41 * hash + Objects.hashCode(this.requestTime); + hash = 41 * hash + Objects.hashCode(this.messageDirection); + hash = 41 * hash + Objects.hashCode(this.stage); + hash = 41 * hash + (int) (this.connectedAt ^ (this.connectedAt >>> 32)); + hash = 41 * hash + (int) (this.requestTimeEpoch ^ (this.requestTimeEpoch >>> 32)); + hash = 41 * hash + Objects.hashCode(this.identity); + hash = 41 * hash + Objects.hashCode(this.requestId); + hash = 41 * hash + Objects.hashCode(this.domainName); + hash = 41 * hash + Objects.hashCode(this.connectionId); + hash = 41 * hash + Objects.hashCode(this.apiId); + + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + if (obj == null) { + return false; + } + + if (getClass() != obj.getClass()) { + return false; + } + + final RequestContext other = (RequestContext) obj; + + if (this.connectedAt != other.connectedAt) { + return false; + } + + if (this.requestTimeEpoch != other.requestTimeEpoch) { + return false; + } + + if (!Objects.equals(this.routeKey, other.routeKey)) { + return false; + } + + if (!Objects.equals(this.messageId, other.messageId)) { + return false; + } + + if (!Objects.equals(this.eventType, other.eventType)) { + return false; + } + + if (!Objects.equals(this.extendedRequestId, other.extendedRequestId)) { + return false; + } + + if (!Objects.equals(this.requestTime, other.requestTime)) { + return false; + } + + if (!Objects.equals(this.messageDirection, other.messageDirection)) { + return false; + } + + if (!Objects.equals(this.stage, other.stage)) { + return false; + } + + if (!Objects.equals(this.requestId, other.requestId)) { + return false; + } + + if (!Objects.equals(this.domainName, other.domainName)) { + return false; + } + + if (!Objects.equals(this.connectionId, other.connectionId)) { + return false; + } + + if (!Objects.equals(this.apiId, other.apiId)) { + return false; + } + + if (!Objects.equals(this.identity, other.identity)) { + return false; + } + + return true; + } + } + + private RequestContext requestContext; + private String body; + private boolean isBase64Encoded = false; + + public RequestContext getRequestContext() { + return requestContext; + } + + public void setRequestContext(RequestContext requestContext) { + this.requestContext = requestContext; + } + + public String getBody() { + return body; + } + + public void setBody(String body) { + this.body = body; + } + + public boolean isIsBase64Encoded() { + return isBase64Encoded; + } + + public void setIsBase64Encoded(boolean isBase64Encoded) { + this.isBase64Encoded = isBase64Encoded; + } + + @Override + public int hashCode() { + int hash = 7; + + hash = 43 * hash + Objects.hashCode(this.requestContext); + hash = 43 * hash + Objects.hashCode(this.body); + hash = 43 * hash + (this.isBase64Encoded ? 1 : 0); + + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + if (obj == null) { + return false; + } + + if (getClass() != obj.getClass()) { + return false; + } + + final APIGatewayV2ProxyRequestEvent other = (APIGatewayV2ProxyRequestEvent) obj; + + if (this.isBase64Encoded != other.isBase64Encoded) { + return false; + } + + if (!Objects.equals(this.body, other.body)) { + return false; + } + + if (!Objects.equals(this.requestContext, other.requestContext)) { + return false; + } + return true; + } +} diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyResponseEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyResponseEvent.java new file mode 100644 index 000000000..3a40f827c --- /dev/null +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyResponseEvent.java @@ -0,0 +1,81 @@ +package com.amazonaws.services.lambda.runtime.events; + +import java.io.Serializable; +import java.util.Objects; + +/** + * @author Tim Gustafson + */ +public class APIGatewayV2ProxyResponseEvent implements Serializable, Cloneable { + + private int statusCode; + private String body; + private boolean isBase64Encoded = false; + + public int getStatusCode() { + return statusCode; + } + + public void setStatusCode(int statusCode) { + this.statusCode = statusCode; + } + + public String getBody() { + return body; + } + + public void setBody(String body) { + this.body = body; + } + + public boolean isIsBase64Encoded() { + return isBase64Encoded; + } + + public void setIsBase64Encoded(boolean isBase64Encoded) { + this.isBase64Encoded = isBase64Encoded; + } + + @Override + public int hashCode() { + int hash = 3; + + hash = 29 * hash + this.statusCode; + hash = 29 * hash + (this.isBase64Encoded ? 1 : 0); + hash = 29 * hash + Objects.hashCode(this.body); + + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + if (obj == null) { + return false; + } + + if (getClass() != obj.getClass()) { + return false; + } + + final APIGatewayV2ProxyResponseEvent other = (APIGatewayV2ProxyResponseEvent) obj; + + if (this.statusCode != other.statusCode) { + return false; + } + + if (this.isBase64Encoded != other.isBase64Encoded) { + return false; + } + + if (!Objects.equals(this.body, other.body)) { + return false; + } + + return true; + } + +} From 5fe769a198d24664d41eb6e735381d5651d21029 Mon Sep 17 00:00:00 2001 From: Tim Gustafson Date: Tue, 23 Jul 2019 15:11:34 +0200 Subject: [PATCH 2/9] Added toString() for API Gateway V2 objects. --- .../events/APIGatewayV2ProxyRequestEvent.java | 110 +++++++++++++++++- .../APIGatewayV2ProxyResponseEvent.java | 20 +++- 2 files changed, 128 insertions(+), 2 deletions(-) diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java index 3cfcd7453..d5892a4c3 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java @@ -4,7 +4,7 @@ import java.util.Objects; /** - * @author Tim Gustafson + * @author Tim Gustafson */ public class APIGatewayV2ProxyRequestEvent implements Serializable, Cloneable { @@ -66,6 +66,23 @@ public boolean equals(Object obj) { return true; } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{"); + + if (getSourceIp() != null) { + sb.append("sourceIp: ").append(getSourceIp()).append(","); + } + if (getUserAgent() != null) { + sb.append("userAgent: ").append(getUserAgent()).append(","); + } + + sb.append("}"); + + return sb.toString(); + } + } public class RequestContext implements Serializable, Cloneable { @@ -293,6 +310,76 @@ public boolean equals(Object obj) { return true; } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{"); + + if (routeKey != null) { + sb.append("routeKey: ").append(routeKey).append(","); + } + + if (messageId != null) { + sb.append("messageId: ").append(messageId).append(","); + } + + if (eventType != null) { + sb.append("eventType: ").append(eventType).append(","); + } + + if (extendedRequestId != null) { + sb.append("extendedRequestId: ").append(extendedRequestId).append(","); + } + + if (requestTime != null) { + sb.append("requestTime: ").append(requestTime).append(","); + } + + if (messageDirection != null) { + sb.append("messageDirection: ").append(messageDirection).append(","); + } + + if (stage != null) { + sb.append("stage: ").append(stage).append(","); + } + + if (connectedAt != 0) { + sb.append("connectedAt: ").append(connectedAt).append(","); + } + + if (messageId != null) { + sb.append("messageId: ").append(messageId).append(","); + } + + if (identity != null) { + sb.append("identity: ").append(identity).append(","); + } + + if (requestTimeEpoch != 0) { + sb.append("requestTimeEpoch: ").append(requestTimeEpoch).append(","); + } + + if (requestId != null) { + sb.append("requestId: ").append(requestId).append(","); + } + + if (domainName != null) { + sb.append("domainName: ").append(domainName).append(","); + } + + if (connectionId != null) { + sb.append("connectionId: ").append(connectionId).append(","); + } + + if (apiId != null) { + sb.append("apiId: ").append(apiId).append(","); + } + + sb.append("}"); + + return sb.toString(); + } } private RequestContext requestContext; @@ -363,4 +450,25 @@ public boolean equals(Object obj) { } return true; } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{"); + + if (requestContext != null) { + sb.append("requestContext: ").append(requestContext).append(","); + } + + if (body != null) { + sb.append("body: ").append(body).append(","); + } + + sb.append("isBase64Encoded: ").append(isBase64Encoded).append(","); + + sb.append("}"); + + return sb.toString(); + } + } diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyResponseEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyResponseEvent.java index 3a40f827c..0b29816ef 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyResponseEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyResponseEvent.java @@ -4,7 +4,7 @@ import java.util.Objects; /** - * @author Tim Gustafson + * @author Tim Gustafson */ public class APIGatewayV2ProxyResponseEvent implements Serializable, Cloneable { @@ -78,4 +78,22 @@ public boolean equals(Object obj) { return true; } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{"); + + sb.append("statusCode: ").append(statusCode).append(","); + + if (body != null) { + sb.append("body: ").append(body).append(","); + } + + sb.append("isBase64Encoded: ").append(isBase64Encoded).append(","); + + sb.append("}"); + + return sb.toString(); + } + } From 2db01c330e7fccdc6ce893d6318c32c73dcc0d6f Mon Sep 17 00:00:00 2001 From: Tim Gustafson Date: Tue, 23 Jul 2019 15:15:23 +0200 Subject: [PATCH 3/9] Updated README.md with APIGatewayV2ProxyRequestEvent and APIGatewayV2ProxyResponseEvent --- aws-lambda-java-events/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aws-lambda-java-events/README.md b/aws-lambda-java-events/README.md index 25b584476..76032ea78 100644 --- a/aws-lambda-java-events/README.md +++ b/aws-lambda-java-events/README.md @@ -3,6 +3,8 @@ ### New Event Models Supported * APIGatewayProxyRequestEvent * APIGatewayProxyResponseEvent +* APIGatewayV2ProxyRequestEvent +* APIGatewayV2ProxyResponseEvent * CloudFrontEvent * CloudWatchLogsEvent * CodeCommitEvent @@ -20,6 +22,8 @@ versions do not need to make any changes to their existing code. The following event models do not require any SDK dependencies * APIGatewayProxyRequestEvent * APIGatewayProxyResponseEvent +* APIGatewayV2ProxyRequestEvent +* APIGatewayV2ProxyResponseEvent * CloudFrontEvent * CloudWatchLogsEvent * CodeCommitEvent From 3aed4d43a06f41712f2940276684a20ad0b939ce Mon Sep 17 00:00:00 2001 From: Tim Gustafson Date: Wed, 24 Jul 2019 11:11:40 +0200 Subject: [PATCH 4/9] Added missing properties Modified inner classes to be static --- .../events/APIGatewayV2ProxyRequestEvent.java | 629 ++++++++++++------ .../APIGatewayV2ProxyResponseEvent.java | 85 +-- 2 files changed, 484 insertions(+), 230 deletions(-) diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java index d5892a4c3..21ef020e0 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java @@ -1,6 +1,7 @@ package com.amazonaws.services.lambda.runtime.events; import java.io.Serializable; +import java.util.Map; import java.util.Objects; /** @@ -8,10 +9,60 @@ */ public class APIGatewayV2ProxyRequestEvent implements Serializable, Cloneable { - public class RequestIdentity implements Serializable, Cloneable { + public static class RequestIdentity implements Serializable, Cloneable { + private String cognitoIdentityPoolId; + private String accountId; + private String cognitoIdentityId; + private String caller; + private String apiKey; private String sourceIp; + private String cognitoAuthenticationType; + private String cognitoAuthenticationProvider; + private String userArn; private String userAgent; + private String user; + private String accessKey; + + public String getCognitoIdentityPoolId() { + return cognitoIdentityPoolId; + } + + public void setCognitoIdentityPoolId(String cognitoIdentityPoolId) { + this.cognitoIdentityPoolId = cognitoIdentityPoolId; + } + + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public String getCognitoIdentityId() { + return cognitoIdentityId; + } + + public void setCognitoIdentityId(String cognitoIdentityId) { + this.cognitoIdentityId = cognitoIdentityId; + } + + public String getCaller() { + return caller; + } + + public void setCaller(String caller) { + this.caller = caller; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } public String getSourceIp() { return sourceIp; @@ -21,6 +72,30 @@ public void setSourceIp(String sourceIp) { this.sourceIp = sourceIp; } + public String getCognitoAuthenticationType() { + return cognitoAuthenticationType; + } + + public void setCognitoAuthenticationType(String cognitoAuthenticationType) { + this.cognitoAuthenticationType = cognitoAuthenticationType; + } + + public String getCognitoAuthenticationProvider() { + return cognitoAuthenticationProvider; + } + + public void setCognitoAuthenticationProvider(String cognitoAuthenticationProvider) { + this.cognitoAuthenticationProvider = cognitoAuthenticationProvider; + } + + public String getUserArn() { + return userArn; + } + + public void setUserArn(String userArn) { + this.userArn = userArn; + } + public String getUserAgent() { return userAgent; } @@ -29,13 +104,37 @@ public void setUserAgent(String userAgent) { this.userAgent = userAgent; } + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + + public String getAccessKey() { + return accessKey; + } + + public void setAccessKey(String accessKey) { + this.accessKey = accessKey; + } + @Override public int hashCode() { int hash = 7; - - hash = 59 * hash + Objects.hashCode(this.sourceIp); - hash = 59 * hash + Objects.hashCode(this.userAgent); - + hash = 29 * hash + (this.cognitoIdentityPoolId != null ? this.cognitoIdentityPoolId.hashCode() : 0); + hash = 29 * hash + (this.accountId != null ? this.accountId.hashCode() : 0); + hash = 29 * hash + (this.cognitoIdentityId != null ? this.cognitoIdentityId.hashCode() : 0); + hash = 29 * hash + (this.caller != null ? this.caller.hashCode() : 0); + hash = 29 * hash + (this.apiKey != null ? this.apiKey.hashCode() : 0); + hash = 29 * hash + (this.sourceIp != null ? this.sourceIp.hashCode() : 0); + hash = 29 * hash + (this.cognitoAuthenticationType != null ? this.cognitoAuthenticationType.hashCode() : 0); + hash = 29 * hash + (this.cognitoAuthenticationProvider != null ? this.cognitoAuthenticationProvider.hashCode() : 0); + hash = 29 * hash + (this.userArn != null ? this.userArn.hashCode() : 0); + hash = 29 * hash + (this.userAgent != null ? this.userAgent.hashCode() : 0); + hash = 29 * hash + (this.user != null ? this.user.hashCode() : 0); + hash = 29 * hash + (this.accessKey != null ? this.accessKey.hashCode() : 0); return hash; } @@ -44,150 +143,181 @@ public boolean equals(Object obj) { if (this == obj) { return true; } - if (obj == null) { return false; } - if (getClass() != obj.getClass()) { return false; } - final RequestIdentity other = (RequestIdentity) obj; - - if (!Objects.equals(this.sourceIp, other.sourceIp)) { + if ((this.cognitoIdentityPoolId == null) ? (other.cognitoIdentityPoolId != null) : !this.cognitoIdentityPoolId.equals(other.cognitoIdentityPoolId)) { return false; } - - if (!Objects.equals(this.userAgent, other.userAgent)) { + if ((this.accountId == null) ? (other.accountId != null) : !this.accountId.equals(other.accountId)) { + return false; + } + if ((this.cognitoIdentityId == null) ? (other.cognitoIdentityId != null) : !this.cognitoIdentityId.equals(other.cognitoIdentityId)) { + return false; + } + if ((this.caller == null) ? (other.caller != null) : !this.caller.equals(other.caller)) { + return false; + } + if ((this.apiKey == null) ? (other.apiKey != null) : !this.apiKey.equals(other.apiKey)) { + return false; + } + if ((this.sourceIp == null) ? (other.sourceIp != null) : !this.sourceIp.equals(other.sourceIp)) { + return false; + } + if ((this.cognitoAuthenticationType == null) ? (other.cognitoAuthenticationType != null) : !this.cognitoAuthenticationType.equals(other.cognitoAuthenticationType)) { + return false; + } + if ((this.cognitoAuthenticationProvider == null) ? (other.cognitoAuthenticationProvider != null) : !this.cognitoAuthenticationProvider.equals(other.cognitoAuthenticationProvider)) { + return false; + } + if ((this.userArn == null) ? (other.userArn != null) : !this.userArn.equals(other.userArn)) { + return false; + } + if ((this.userAgent == null) ? (other.userAgent != null) : !this.userAgent.equals(other.userAgent)) { + return false; + } + if ((this.user == null) ? (other.user != null) : !this.user.equals(other.user)) { + return false; + } + if ((this.accessKey == null) ? (other.accessKey != null) : !this.accessKey.equals(other.accessKey)) { return false; } - return true; } @Override public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - - if (getSourceIp() != null) { - sb.append("sourceIp: ").append(getSourceIp()).append(","); - } - if (getUserAgent() != null) { - sb.append("userAgent: ").append(getUserAgent()).append(","); - } - - sb.append("}"); - - return sb.toString(); + return "{cognitoIdentityPoolId=" + cognitoIdentityPoolId + + ", accountId=" + accountId + + ", cognitoIdentityId=" + cognitoIdentityId + + ", caller=" + caller + + ", apiKey=" + apiKey + + ", sourceIp=" + sourceIp + + ", cognitoAuthenticationType=" + cognitoAuthenticationType + + ", cognitoAuthenticationProvider=" + cognitoAuthenticationProvider + + ", userArn=" + userArn + + ", userAgent=" + userAgent + + ", user=" + user + + ", accessKey=" + accessKey + + "}"; } - } - public class RequestContext implements Serializable, Cloneable { + public static class RequestContext implements Serializable, Cloneable { - private String routeKey; - private String messageId; + private String accountId; + private String resourceId; + private String stage; + private String requestId; + private RequestIdentity identity; + private String ResourcePath; + private String authorizer; + private String httpMethod; + private String apiId; + private long connectedAt; + private String connectionId; + private String domainName; + private String error; private String eventType; private String extendedRequestId; - private String requestTime; + private String integrationLatency; private String messageDirection; - private String stage; - private long connectedAt; + private String messageId; + private String requestTime; private long requestTimeEpoch; - private RequestIdentity identity; - private String requestId; - private String domainName; - private String connectionId; - private String apiId; + private String routeKey; + private String status; - public String getRouteKey() { - return routeKey; + public String getAccountId() { + return accountId; } - public void setRouteKey(String routeKey) { - this.routeKey = routeKey; + public void setAccountId(String accountId) { + this.accountId = accountId; } - public String getMessageId() { - return messageId; + public String getResourceId() { + return resourceId; } - public void setMessageId(String messageId) { - this.messageId = messageId; + public void setResourceId(String resourceId) { + this.resourceId = resourceId; } - public String getEventType() { - return eventType; + public String getStage() { + return stage; } - public void setEventType(String eventType) { - this.eventType = eventType; + public void setStage(String stage) { + this.stage = stage; } - public String getExtendedRequestId() { - return extendedRequestId; + public String getRequestId() { + return requestId; } - public void setExtendedRequestId(String extendedRequestId) { - this.extendedRequestId = extendedRequestId; + public void setRequestId(String requestId) { + this.requestId = requestId; } - public String getRequestTime() { - return requestTime; + public RequestIdentity getIdentity() { + return identity; } - public void setRequestTime(String requestTime) { - this.requestTime = requestTime; + public void setIdentity(RequestIdentity identity) { + this.identity = identity; } - public String getMessageDirection() { - return messageDirection; + public String getResourcePath() { + return ResourcePath; } - public void setMessageDirection(String messageDirection) { - this.messageDirection = messageDirection; + public void setResourcePath(String ResourcePath) { + this.ResourcePath = ResourcePath; } - public String getStage() { - return stage; + public String getAuthorizer() { + return authorizer; } - public void setStage(String stage) { - this.stage = stage; + public void setAuthorizer(String authorizer) { + this.authorizer = authorizer; } - public long getConnectedAt() { - return connectedAt; + public String getHttpMethod() { + return httpMethod; } - public void setConnectedAt(long connectedAt) { - this.connectedAt = connectedAt; + public void setHttpMethod(String httpMethod) { + this.httpMethod = httpMethod; } - public long getRequestTimeEpoch() { - return requestTimeEpoch; + public String getApiId() { + return apiId; } - public void setRequestTimeEpoch(long requestTimeEpoch) { - this.requestTimeEpoch = requestTimeEpoch; + public void setApiId(String apiId) { + this.apiId = apiId; } - public RequestIdentity getIdentity() { - return identity; + public long getConnectedAt() { + return connectedAt; } - public void setIdentity(RequestIdentity identity) { - this.identity = identity; + public void setConnectedAt(long connectedAt) { + this.connectedAt = connectedAt; } - public String getRequestId() { - return requestId; + public String getConnectionId() { + return connectionId; } - public void setRequestId(String requestId) { - this.requestId = requestId; + public void setConnectionId(String connectionId) { + this.connectionId = connectionId; } public String getDomainName() { @@ -198,193 +328,308 @@ public void setDomainName(String domainName) { this.domainName = domainName; } - public String getConnectionId() { - return connectionId; + public String getError() { + return error; } - public void setConnectionId(String connectionId) { - this.connectionId = connectionId; + public void setError(String error) { + this.error = error; } - public String getApiId() { - return apiId; + public String getEventType() { + return eventType; } - public void setApiId(String apiId) { - this.apiId = apiId; + public void setEventType(String eventType) { + this.eventType = eventType; } - @Override - public int hashCode() { - int hash = 7; + public String getExtendedRequestId() { + return extendedRequestId; + } + + public void setExtendedRequestId(String extendedRequestId) { + this.extendedRequestId = extendedRequestId; + } + + public String getIntegrationLatency() { + return integrationLatency; + } + + public void setIntegrationLatency(String integrationLatency) { + this.integrationLatency = integrationLatency; + } + + public String getMessageDirection() { + return messageDirection; + } - hash = 41 * hash + Objects.hashCode(this.routeKey); - hash = 41 * hash + Objects.hashCode(this.messageId); - hash = 41 * hash + Objects.hashCode(this.eventType); - hash = 41 * hash + Objects.hashCode(this.extendedRequestId); - hash = 41 * hash + Objects.hashCode(this.requestTime); - hash = 41 * hash + Objects.hashCode(this.messageDirection); - hash = 41 * hash + Objects.hashCode(this.stage); - hash = 41 * hash + (int) (this.connectedAt ^ (this.connectedAt >>> 32)); - hash = 41 * hash + (int) (this.requestTimeEpoch ^ (this.requestTimeEpoch >>> 32)); - hash = 41 * hash + Objects.hashCode(this.identity); - hash = 41 * hash + Objects.hashCode(this.requestId); - hash = 41 * hash + Objects.hashCode(this.domainName); - hash = 41 * hash + Objects.hashCode(this.connectionId); - hash = 41 * hash + Objects.hashCode(this.apiId); + public void setMessageDirection(String messageDirection) { + this.messageDirection = messageDirection; + } + public String getMessageId() { + return messageId; + } + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + public String getRequestTime() { + return requestTime; + } + + public void setRequestTime(String requestTime) { + this.requestTime = requestTime; + } + + public long getRequestTimeEpoch() { + return requestTimeEpoch; + } + + public void setRequestTimeEpoch(long requestTimeEpoch) { + this.requestTimeEpoch = requestTimeEpoch; + } + + public String getRouteKey() { + return routeKey; + } + + public void setRouteKey(String routeKey) { + this.routeKey = routeKey; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + @Override + public int hashCode() { + int hash = 3; + hash = 59 * hash + (this.accountId != null ? this.accountId.hashCode() : 0); + hash = 59 * hash + (this.resourceId != null ? this.resourceId.hashCode() : 0); + hash = 59 * hash + (this.stage != null ? this.stage.hashCode() : 0); + hash = 59 * hash + (this.requestId != null ? this.requestId.hashCode() : 0); + hash = 59 * hash + (this.identity != null ? this.identity.hashCode() : 0); + hash = 59 * hash + (this.ResourcePath != null ? this.ResourcePath.hashCode() : 0); + hash = 59 * hash + (this.authorizer != null ? this.authorizer.hashCode() : 0); + hash = 59 * hash + (this.httpMethod != null ? this.httpMethod.hashCode() : 0); + hash = 59 * hash + (this.apiId != null ? this.apiId.hashCode() : 0); + hash = 59 * hash + (int) (this.connectedAt ^ (this.connectedAt >>> 32)); + hash = 59 * hash + (this.connectionId != null ? this.connectionId.hashCode() : 0); + hash = 59 * hash + (this.domainName != null ? this.domainName.hashCode() : 0); + hash = 59 * hash + (this.error != null ? this.error.hashCode() : 0); + hash = 59 * hash + (this.eventType != null ? this.eventType.hashCode() : 0); + hash = 59 * hash + (this.extendedRequestId != null ? this.extendedRequestId.hashCode() : 0); + hash = 59 * hash + (this.integrationLatency != null ? this.integrationLatency.hashCode() : 0); + hash = 59 * hash + (this.messageDirection != null ? this.messageDirection.hashCode() : 0); + hash = 59 * hash + (this.messageId != null ? this.messageId.hashCode() : 0); + hash = 59 * hash + (this.requestTime != null ? this.requestTime.hashCode() : 0); + hash = 59 * hash + (int) (this.requestTimeEpoch ^ (this.requestTimeEpoch >>> 32)); + hash = 59 * hash + (this.routeKey != null ? this.routeKey.hashCode() : 0); + hash = 59 * hash + (this.status != null ? this.status.hashCode() : 0); return hash; } + @Override + public String toString() { + return "{accountId=" + accountId + + ", resourceId=" + resourceId + + ", stage=" + stage + + ", requestId=" + requestId + + ", identity=" + identity + + ", ResourcePath=" + ResourcePath + + ", authorizer=" + authorizer + + ", httpMethod=" + httpMethod + + ", apiId=" + apiId + + ", connectedAt=" + connectedAt + + ", connectionId=" + connectionId + + ", domainName=" + domainName + + ", error=" + error + + ", eventType=" + eventType + + ", extendedRequestId=" + extendedRequestId + + ", integrationLatency=" + integrationLatency + + ", messageDirection=" + messageDirection + + ", messageId=" + messageId + + ", requestTime=" + requestTime + + ", requestTimeEpoch=" + requestTimeEpoch + + ", routeKey=" + routeKey + + ", status=" + status + + "}"; + } + @Override public boolean equals(Object obj) { if (this == obj) { return true; } - if (obj == null) { return false; } - if (getClass() != obj.getClass()) { return false; } - final RequestContext other = (RequestContext) obj; - if (this.connectedAt != other.connectedAt) { return false; } - if (this.requestTimeEpoch != other.requestTimeEpoch) { return false; } - - if (!Objects.equals(this.routeKey, other.routeKey)) { + if ((this.accountId == null) ? (other.accountId != null) : !this.accountId.equals(other.accountId)) { return false; } - - if (!Objects.equals(this.messageId, other.messageId)) { + if ((this.resourceId == null) ? (other.resourceId != null) : !this.resourceId.equals(other.resourceId)) { return false; } - - if (!Objects.equals(this.eventType, other.eventType)) { + if ((this.stage == null) ? (other.stage != null) : !this.stage.equals(other.stage)) { return false; } - - if (!Objects.equals(this.extendedRequestId, other.extendedRequestId)) { + if ((this.requestId == null) ? (other.requestId != null) : !this.requestId.equals(other.requestId)) { return false; } - - if (!Objects.equals(this.requestTime, other.requestTime)) { + if ((this.ResourcePath == null) ? (other.ResourcePath != null) : !this.ResourcePath.equals(other.ResourcePath)) { return false; } - - if (!Objects.equals(this.messageDirection, other.messageDirection)) { + if ((this.authorizer == null) ? (other.authorizer != null) : !this.authorizer.equals(other.authorizer)) { return false; } - - if (!Objects.equals(this.stage, other.stage)) { + if ((this.httpMethod == null) ? (other.httpMethod != null) : !this.httpMethod.equals(other.httpMethod)) { return false; } - - if (!Objects.equals(this.requestId, other.requestId)) { + if ((this.apiId == null) ? (other.apiId != null) : !this.apiId.equals(other.apiId)) { return false; } - - if (!Objects.equals(this.domainName, other.domainName)) { + if ((this.connectionId == null) ? (other.connectionId != null) : !this.connectionId.equals(other.connectionId)) { return false; } - - if (!Objects.equals(this.connectionId, other.connectionId)) { + if ((this.domainName == null) ? (other.domainName != null) : !this.domainName.equals(other.domainName)) { return false; } - - if (!Objects.equals(this.apiId, other.apiId)) { + if ((this.error == null) ? (other.error != null) : !this.error.equals(other.error)) { return false; } - - if (!Objects.equals(this.identity, other.identity)) { + if ((this.eventType == null) ? (other.eventType != null) : !this.eventType.equals(other.eventType)) { + return false; + } + if ((this.extendedRequestId == null) ? (other.extendedRequestId != null) : !this.extendedRequestId.equals(other.extendedRequestId)) { + return false; + } + if ((this.integrationLatency == null) ? (other.integrationLatency != null) : !this.integrationLatency.equals(other.integrationLatency)) { + return false; + } + if ((this.messageDirection == null) ? (other.messageDirection != null) : !this.messageDirection.equals(other.messageDirection)) { + return false; + } + if ((this.messageId == null) ? (other.messageId != null) : !this.messageId.equals(other.messageId)) { + return false; + } + if ((this.requestTime == null) ? (other.requestTime != null) : !this.requestTime.equals(other.requestTime)) { + return false; + } + if ((this.routeKey == null) ? (other.routeKey != null) : !this.routeKey.equals(other.routeKey)) { + return false; + } + if ((this.status == null) ? (other.status != null) : !this.status.equals(other.status)) { + return false; + } + if (this.identity != other.identity && (this.identity == null || !this.identity.equals(other.identity))) { return false; } - return true; } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); + } - if (routeKey != null) { - sb.append("routeKey: ").append(routeKey).append(","); - } + private String resource; + private String path; + private String httpMethod; + private Map headers; + private Map multiValueHeaders; + private Map queryStringParameters; + private Map multiValueQueryStringParameters; + private Map pathParameters; + private Map stageVariables; + private RequestContext requestContext; + private String body; + private boolean isBase64Encoded = false; - if (messageId != null) { - sb.append("messageId: ").append(messageId).append(","); - } + public String getResource() { + return resource; + } - if (eventType != null) { - sb.append("eventType: ").append(eventType).append(","); - } + public void setResource(String resource) { + this.resource = resource; + } - if (extendedRequestId != null) { - sb.append("extendedRequestId: ").append(extendedRequestId).append(","); - } + public String getPath() { + return path; + } - if (requestTime != null) { - sb.append("requestTime: ").append(requestTime).append(","); - } + public void setPath(String path) { + this.path = path; + } - if (messageDirection != null) { - sb.append("messageDirection: ").append(messageDirection).append(","); - } + public String getHttpMethod() { + return httpMethod; + } - if (stage != null) { - sb.append("stage: ").append(stage).append(","); - } + public void setHttpMethod(String httpMethod) { + this.httpMethod = httpMethod; + } - if (connectedAt != 0) { - sb.append("connectedAt: ").append(connectedAt).append(","); - } + public Map getHeaders() { + return headers; + } - if (messageId != null) { - sb.append("messageId: ").append(messageId).append(","); - } + public void setHeaders(Map headers) { + this.headers = headers; + } - if (identity != null) { - sb.append("identity: ").append(identity).append(","); - } + public Map getMultiValueHeaders() { + return multiValueHeaders; + } - if (requestTimeEpoch != 0) { - sb.append("requestTimeEpoch: ").append(requestTimeEpoch).append(","); - } + public void setMultiValueHeaders(Map multiValueHeaders) { + this.multiValueHeaders = multiValueHeaders; + } - if (requestId != null) { - sb.append("requestId: ").append(requestId).append(","); - } + public Map getQueryStringParameters() { + return queryStringParameters; + } - if (domainName != null) { - sb.append("domainName: ").append(domainName).append(","); - } + public void setQueryStringParameters(Map queryStringParameters) { + this.queryStringParameters = queryStringParameters; + } - if (connectionId != null) { - sb.append("connectionId: ").append(connectionId).append(","); - } + public Map getMultiValueQueryStringParameters() { + return multiValueQueryStringParameters; + } - if (apiId != null) { - sb.append("apiId: ").append(apiId).append(","); - } + public void setMultiValueQueryStringParameters(Map multiValueQueryStringParameters) { + this.multiValueQueryStringParameters = multiValueQueryStringParameters; + } - sb.append("}"); + public Map getPathParameters() { + return pathParameters; + } - return sb.toString(); - } + public void setPathParameters(Map pathParameters) { + this.pathParameters = pathParameters; } - private RequestContext requestContext; - private String body; - private boolean isBase64Encoded = false; + public Map getStageVariables() { + return stageVariables; + } + + public void setStageVariables(Map stageVariables) { + this.stageVariables = stageVariables; + } public RequestContext getRequestContext() { return requestContext; diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyResponseEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyResponseEvent.java index 0b29816ef..728a2be80 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyResponseEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyResponseEvent.java @@ -1,16 +1,26 @@ package com.amazonaws.services.lambda.runtime.events; import java.io.Serializable; -import java.util.Objects; +import java.util.Map; /** * @author Tim Gustafson */ public class APIGatewayV2ProxyResponseEvent implements Serializable, Cloneable { + private boolean isBase64Encoded = false; private int statusCode; + private Map headers; + private Map multiValueHeaders; private String body; - private boolean isBase64Encoded = false; + + public boolean isIsBase64Encoded() { + return isBase64Encoded; + } + + public void setIsBase64Encoded(boolean isBase64Encoded) { + this.isBase64Encoded = isBase64Encoded; + } public int getStatusCode() { return statusCode; @@ -20,30 +30,38 @@ public void setStatusCode(int statusCode) { this.statusCode = statusCode; } - public String getBody() { - return body; + public Map getHeaders() { + return headers; } - public void setBody(String body) { - this.body = body; + public void setHeaders(Map headers) { + this.headers = headers; } - public boolean isIsBase64Encoded() { - return isBase64Encoded; + public Map getMultiValueHeaders() { + return multiValueHeaders; } - public void setIsBase64Encoded(boolean isBase64Encoded) { - this.isBase64Encoded = isBase64Encoded; + public void setMultiValueHeaders(Map multiValueHeaders) { + this.multiValueHeaders = multiValueHeaders; + } + + public String getBody() { + return body; + } + + public void setBody(String body) { + this.body = body; } @Override public int hashCode() { int hash = 3; - - hash = 29 * hash + this.statusCode; - hash = 29 * hash + (this.isBase64Encoded ? 1 : 0); - hash = 29 * hash + Objects.hashCode(this.body); - + hash = 71 * hash + (this.isBase64Encoded ? 1 : 0); + hash = 71 * hash + this.statusCode; + hash = 71 * hash + (this.headers != null ? this.headers.hashCode() : 0); + hash = 71 * hash + (this.multiValueHeaders != null ? this.multiValueHeaders.hashCode() : 0); + hash = 71 * hash + (this.body != null ? this.body.hashCode() : 0); return hash; } @@ -52,48 +70,39 @@ public boolean equals(Object obj) { if (this == obj) { return true; } - if (obj == null) { return false; } - if (getClass() != obj.getClass()) { return false; } - final APIGatewayV2ProxyResponseEvent other = (APIGatewayV2ProxyResponseEvent) obj; - + if (this.isBase64Encoded != other.isBase64Encoded) { + return false; + } if (this.statusCode != other.statusCode) { return false; } - - if (this.isBase64Encoded != other.isBase64Encoded) { + if ((this.body == null) ? (other.body != null) : !this.body.equals(other.body)) { return false; } - - if (!Objects.equals(this.body, other.body)) { + if (this.headers != other.headers && (this.headers == null || !this.headers.equals(other.headers))) { + return false; + } + if (this.multiValueHeaders != other.multiValueHeaders && (this.multiValueHeaders == null || !this.multiValueHeaders.equals(other.multiValueHeaders))) { return false; } - return true; } @Override public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - - sb.append("statusCode: ").append(statusCode).append(","); - - if (body != null) { - sb.append("body: ").append(body).append(","); - } - - sb.append("isBase64Encoded: ").append(isBase64Encoded).append(","); - - sb.append("}"); - - return sb.toString(); + return "{isBase64Encoded=" + isBase64Encoded + + ", statusCode=" + statusCode + + ", headers=" + headers + + ", multiValueHeaders=" + multiValueHeaders + + ", body=" + body + + "}"; } } From 49eb98a68b2860e6a0ae1161ae7f589c104019e6 Mon Sep 17 00:00:00 2001 From: Tim Gustafson Date: Wed, 24 Jul 2019 16:38:44 +0200 Subject: [PATCH 5/9] Creating classes to handle custom authorizers --- .../events/APIGatewayV2AuthorizerRequest.java | 17 +++++++++++++++++ .../events/APIGatewayV2AuthorizerResponse.java | 9 +++++++++ 2 files changed, 26 insertions(+) create mode 100644 aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2AuthorizerRequest.java create mode 100644 aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2AuthorizerResponse.java diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2AuthorizerRequest.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2AuthorizerRequest.java new file mode 100644 index 000000000..c895161ac --- /dev/null +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2AuthorizerRequest.java @@ -0,0 +1,17 @@ +package com.amazonaws.services.lambda.runtime.events; + +import java.util.Map; + +/** + * @author Tim Gustafson + */ +public class APIGatewayV2AuthorizerRequest { + + private Map headers; + private Map multiValueHeaders; + private Map queryStringParameters; + private Map multiValueQueryStringParameters; + private Map stageVariables; + private APIGatewayV2ProxyRequestEvent.RequestContext requestContext; + +} diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2AuthorizerResponse.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2AuthorizerResponse.java new file mode 100644 index 000000000..dc7fa97e5 --- /dev/null +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2AuthorizerResponse.java @@ -0,0 +1,9 @@ + +package com.amazonaws.services.lambda.runtime.events; + +/** + * @author Tim Gustafson + */ +public class APIGatewayV2AuthorizerResponse { + +} From cdec3ed04170ade8422d5b60226224f0f03ab87a Mon Sep 17 00:00:00 2001 From: Tim Gustafson Date: Fri, 26 Jul 2019 16:42:40 +0200 Subject: [PATCH 6/9] Changed authorizer to a Map to handle complex types. --- .../runtime/events/APIGatewayV2ProxyRequestEvent.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java index 21ef020e0..9c7f23eea 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java @@ -215,7 +215,7 @@ public static class RequestContext implements Serializable, Cloneable { private String requestId; private RequestIdentity identity; private String ResourcePath; - private String authorizer; + private Map authorizer; private String httpMethod; private String apiId; private long connectedAt; @@ -280,11 +280,11 @@ public void setResourcePath(String ResourcePath) { this.ResourcePath = ResourcePath; } - public String getAuthorizer() { + public Map getAuthorizer() { return authorizer; } - public void setAuthorizer(String authorizer) { + public void setAuthorizer(Map authorizer) { this.authorizer = authorizer; } From 211b0509405351b58126ab25041cf5fbee82f1e7 Mon Sep 17 00:00:00 2001 From: Tim Gustafson Date: Mon, 29 Jul 2019 05:55:39 +0200 Subject: [PATCH 7/9] Removing custom authorizers for now, until I have time to fully develop them. --- .../events/APIGatewayV2AuthorizerRequest.java | 17 ----------------- .../events/APIGatewayV2AuthorizerResponse.java | 9 --------- 2 files changed, 26 deletions(-) delete mode 100644 aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2AuthorizerRequest.java delete mode 100644 aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2AuthorizerResponse.java diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2AuthorizerRequest.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2AuthorizerRequest.java deleted file mode 100644 index c895161ac..000000000 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2AuthorizerRequest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.amazonaws.services.lambda.runtime.events; - -import java.util.Map; - -/** - * @author Tim Gustafson - */ -public class APIGatewayV2AuthorizerRequest { - - private Map headers; - private Map multiValueHeaders; - private Map queryStringParameters; - private Map multiValueQueryStringParameters; - private Map stageVariables; - private APIGatewayV2ProxyRequestEvent.RequestContext requestContext; - -} diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2AuthorizerResponse.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2AuthorizerResponse.java deleted file mode 100644 index dc7fa97e5..000000000 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2AuthorizerResponse.java +++ /dev/null @@ -1,9 +0,0 @@ - -package com.amazonaws.services.lambda.runtime.events; - -/** - * @author Tim Gustafson - */ -public class APIGatewayV2AuthorizerResponse { - -} From c473517aee49b49957983ff06ddb9170e3af6b44 Mon Sep 17 00:00:00 2001 From: Mukhtar Haji Date: Tue, 30 Jul 2019 20:54:21 +0100 Subject: [PATCH 8/9] Multivalue header and query-params to List To be consistent with APIGatewayProxyRequestEvent. Also set serialVersionUID. --- .../events/APIGatewayV2ProxyRequestEvent.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java index 9c7f23eea..0f2cbb184 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java @@ -1,6 +1,7 @@ package com.amazonaws.services.lambda.runtime.events; import java.io.Serializable; +import java.util.List; import java.util.Map; import java.util.Objects; @@ -9,8 +10,12 @@ */ public class APIGatewayV2ProxyRequestEvent implements Serializable, Cloneable { + private static final long serialVersionUID = 5695319264103347099L; + public static class RequestIdentity implements Serializable, Cloneable { + private static final long serialVersionUID = -3276649362684921217L; + private String cognitoIdentityPoolId; private String accountId; private String cognitoIdentityId; @@ -209,6 +214,8 @@ public String toString() { public static class RequestContext implements Serializable, Cloneable { + private static final long serialVersionUID = -6641935365992304860L; + private String accountId; private String resourceId; private String stage; @@ -550,9 +557,9 @@ public boolean equals(Object obj) { private String path; private String httpMethod; private Map headers; - private Map multiValueHeaders; + private Map> multiValueHeaders; private Map queryStringParameters; - private Map multiValueQueryStringParameters; + private Map> multiValueQueryStringParameters; private Map pathParameters; private Map stageVariables; private RequestContext requestContext; @@ -591,11 +598,11 @@ public void setHeaders(Map headers) { this.headers = headers; } - public Map getMultiValueHeaders() { + public Map> getMultiValueHeaders() { return multiValueHeaders; } - public void setMultiValueHeaders(Map multiValueHeaders) { + public void setMultiValueHeaders(Map> multiValueHeaders) { this.multiValueHeaders = multiValueHeaders; } @@ -607,11 +614,11 @@ public void setQueryStringParameters(Map queryStringParameters) this.queryStringParameters = queryStringParameters; } - public Map getMultiValueQueryStringParameters() { + public Map> getMultiValueQueryStringParameters() { return multiValueQueryStringParameters; } - public void setMultiValueQueryStringParameters(Map multiValueQueryStringParameters) { + public void setMultiValueQueryStringParameters(Map> multiValueQueryStringParameters) { this.multiValueQueryStringParameters = multiValueQueryStringParameters; } From fdfc271e9c1977dba02cfdf20f4c18808e2fcd75 Mon Sep 17 00:00:00 2001 From: Mukhtar Haji Date: Tue, 30 Jul 2019 20:56:14 +0100 Subject: [PATCH 9/9] Set serialVersionUID on APIGatewayV2ProxyResponseEvent --- .../lambda/runtime/events/APIGatewayV2ProxyResponseEvent.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyResponseEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyResponseEvent.java index 728a2be80..c3ecff89b 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyResponseEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyResponseEvent.java @@ -8,6 +8,8 @@ */ public class APIGatewayV2ProxyResponseEvent implements Serializable, Cloneable { + private static final long serialVersionUID = -5155789062248356200L; + private boolean isBase64Encoded = false; private int statusCode; private Map headers;