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 0f2cbb18..c8a64149 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,726 +1,11 @@ package com.amazonaws.services.lambda.runtime.events; -import java.io.Serializable; -import java.util.List; -import java.util.Map; -import java.util.Objects; - /** - * @author Tim Gustafson + * @deprecated + * This class is for use with API Gateway WebSockets, and has been renamed explicitly as {@link APIGatewayV2WebSocketEvent} + * To integrate with API Gateway's HTTP API Events, use one of: + * * {@link APIGatewayV2HTTPEvent} (payload version 2.0) + * * {@link APIGatewayProxyRequestEvent} (payload version 1.0) */ -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; - 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; - } - - 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; - } - - 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 = 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; - } - - @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 ((this.cognitoIdentityPoolId == null) ? (other.cognitoIdentityPoolId != null) : !this.cognitoIdentityPoolId.equals(other.cognitoIdentityPoolId)) { - return false; - } - 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() { - 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 static class RequestContext implements Serializable, Cloneable { - - private static final long serialVersionUID = -6641935365992304860L; - - private String accountId; - private String resourceId; - private String stage; - private String requestId; - private RequestIdentity identity; - private String ResourcePath; - private Map 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 integrationLatency; - private String messageDirection; - private String messageId; - private String requestTime; - private long requestTimeEpoch; - private String routeKey; - private String status; - - public String getAccountId() { - return accountId; - } - - public void setAccountId(String accountId) { - this.accountId = accountId; - } - - public String getResourceId() { - return resourceId; - } - - public void setResourceId(String resourceId) { - this.resourceId = resourceId; - } - - public String getStage() { - return stage; - } - - public void setStage(String stage) { - this.stage = stage; - } - - public String getRequestId() { - return requestId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - public RequestIdentity getIdentity() { - return identity; - } - - public void setIdentity(RequestIdentity identity) { - this.identity = identity; - } - - public String getResourcePath() { - return ResourcePath; - } - - public void setResourcePath(String ResourcePath) { - this.ResourcePath = ResourcePath; - } - - public Map getAuthorizer() { - return authorizer; - } - - public void setAuthorizer(Map authorizer) { - this.authorizer = authorizer; - } - - public String getHttpMethod() { - return httpMethod; - } - - public void setHttpMethod(String httpMethod) { - this.httpMethod = httpMethod; - } - - public String getApiId() { - return apiId; - } - - public void setApiId(String apiId) { - this.apiId = apiId; - } - - public long getConnectedAt() { - return connectedAt; - } - - public void setConnectedAt(long connectedAt) { - this.connectedAt = connectedAt; - } - - public String getConnectionId() { - return connectionId; - } - - public void setConnectionId(String connectionId) { - this.connectionId = connectionId; - } - - public String getDomainName() { - return domainName; - } - - public void setDomainName(String domainName) { - this.domainName = domainName; - } - - public String getError() { - return error; - } - - public void setError(String error) { - this.error = error; - } - - 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 getIntegrationLatency() { - return integrationLatency; - } - - public void setIntegrationLatency(String integrationLatency) { - this.integrationLatency = integrationLatency; - } - - public String getMessageDirection() { - return messageDirection; - } - - 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 ((this.accountId == null) ? (other.accountId != null) : !this.accountId.equals(other.accountId)) { - return false; - } - if ((this.resourceId == null) ? (other.resourceId != null) : !this.resourceId.equals(other.resourceId)) { - return false; - } - if ((this.stage == null) ? (other.stage != null) : !this.stage.equals(other.stage)) { - return false; - } - if ((this.requestId == null) ? (other.requestId != null) : !this.requestId.equals(other.requestId)) { - return false; - } - if ((this.ResourcePath == null) ? (other.ResourcePath != null) : !this.ResourcePath.equals(other.ResourcePath)) { - return false; - } - if ((this.authorizer == null) ? (other.authorizer != null) : !this.authorizer.equals(other.authorizer)) { - return false; - } - if ((this.httpMethod == null) ? (other.httpMethod != null) : !this.httpMethod.equals(other.httpMethod)) { - return false; - } - if ((this.apiId == null) ? (other.apiId != null) : !this.apiId.equals(other.apiId)) { - return false; - } - if ((this.connectionId == null) ? (other.connectionId != null) : !this.connectionId.equals(other.connectionId)) { - return false; - } - if ((this.domainName == null) ? (other.domainName != null) : !this.domainName.equals(other.domainName)) { - return false; - } - if ((this.error == null) ? (other.error != null) : !this.error.equals(other.error)) { - return false; - } - 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; - } - - } - - 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; - - public String getResource() { - return resource; - } - - public void setResource(String resource) { - this.resource = resource; - } - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - public String getHttpMethod() { - return httpMethod; - } - - public void setHttpMethod(String httpMethod) { - this.httpMethod = httpMethod; - } - - public Map getHeaders() { - return headers; - } - - public void setHeaders(Map headers) { - this.headers = headers; - } - - public Map> getMultiValueHeaders() { - return multiValueHeaders; - } - - public void setMultiValueHeaders(Map> multiValueHeaders) { - this.multiValueHeaders = multiValueHeaders; - } - - public Map getQueryStringParameters() { - return queryStringParameters; - } - - public void setQueryStringParameters(Map queryStringParameters) { - this.queryStringParameters = queryStringParameters; - } - - public Map> getMultiValueQueryStringParameters() { - return multiValueQueryStringParameters; - } - - public void setMultiValueQueryStringParameters(Map> multiValueQueryStringParameters) { - this.multiValueQueryStringParameters = multiValueQueryStringParameters; - } - - public Map getPathParameters() { - return pathParameters; - } - - public void setPathParameters(Map pathParameters) { - this.pathParameters = pathParameters; - } - - public Map getStageVariables() { - return stageVariables; - } - - public void setStageVariables(Map stageVariables) { - this.stageVariables = stageVariables; - } - - 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; - } - - @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(); - } - -} +@Deprecated() +public class APIGatewayV2ProxyRequestEvent extends APIGatewayV2WebSocketEvent {} 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 c3ecff89..d920e784 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,110 +1,9 @@ package com.amazonaws.services.lambda.runtime.events; -import java.io.Serializable; -import java.util.Map; - /** - * @author Tim Gustafson + * @deprecated + * This class is for responding to API Gateway WebSocket events, and has been renamed explicitly as {@link APIGatewayV2WebSocketResponse} + * To response to API Gateway's HTTP API Events, use {@link APIGatewayV2HTTPResponse} */ -public class APIGatewayV2ProxyResponseEvent implements Serializable, Cloneable { - - private static final long serialVersionUID = -5155789062248356200L; - - private boolean isBase64Encoded = false; - private int statusCode; - private Map headers; - private Map multiValueHeaders; - private String body; - - public boolean isIsBase64Encoded() { - return isBase64Encoded; - } - - public void setIsBase64Encoded(boolean isBase64Encoded) { - this.isBase64Encoded = isBase64Encoded; - } - - public int getStatusCode() { - return statusCode; - } - - public void setStatusCode(int statusCode) { - this.statusCode = statusCode; - } - - public Map getHeaders() { - return headers; - } - - public void setHeaders(Map headers) { - this.headers = headers; - } - - public Map getMultiValueHeaders() { - return multiValueHeaders; - } - - 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 = 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; - } - - @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.isBase64Encoded != other.isBase64Encoded) { - return false; - } - if (this.statusCode != other.statusCode) { - return false; - } - if ((this.body == null) ? (other.body != null) : !this.body.equals(other.body)) { - return false; - } - 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() { - return "{isBase64Encoded=" + isBase64Encoded - + ", statusCode=" + statusCode - + ", headers=" + headers - + ", multiValueHeaders=" + multiValueHeaders - + ", body=" + body - + "}"; - } - -} +@Deprecated +public class APIGatewayV2ProxyResponseEvent extends APIGatewayV2WebSocketResponse {} diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2WebSocketEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2WebSocketEvent.java new file mode 100644 index 00000000..43a9966b --- /dev/null +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2WebSocketEvent.java @@ -0,0 +1,726 @@ +package com.amazonaws.services.lambda.runtime.events; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * @author Tim Gustafson + */ +public class APIGatewayV2WebSocketEvent 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; + 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; + } + + 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; + } + + 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 = 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; + } + + @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 ((this.cognitoIdentityPoolId == null) ? (other.cognitoIdentityPoolId != null) : !this.cognitoIdentityPoolId.equals(other.cognitoIdentityPoolId)) { + return false; + } + 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() { + 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 static class RequestContext implements Serializable, Cloneable { + + private static final long serialVersionUID = -6641935365992304860L; + + private String accountId; + private String resourceId; + private String stage; + private String requestId; + private RequestIdentity identity; + private String ResourcePath; + private Map 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 integrationLatency; + private String messageDirection; + private String messageId; + private String requestTime; + private long requestTimeEpoch; + private String routeKey; + private String status; + + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public String getResourceId() { + return resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + public String getStage() { + return stage; + } + + public void setStage(String stage) { + this.stage = stage; + } + + public String getRequestId() { + return requestId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + public RequestIdentity getIdentity() { + return identity; + } + + public void setIdentity(RequestIdentity identity) { + this.identity = identity; + } + + public String getResourcePath() { + return ResourcePath; + } + + public void setResourcePath(String ResourcePath) { + this.ResourcePath = ResourcePath; + } + + public Map getAuthorizer() { + return authorizer; + } + + public void setAuthorizer(Map authorizer) { + this.authorizer = authorizer; + } + + public String getHttpMethod() { + return httpMethod; + } + + public void setHttpMethod(String httpMethod) { + this.httpMethod = httpMethod; + } + + public String getApiId() { + return apiId; + } + + public void setApiId(String apiId) { + this.apiId = apiId; + } + + public long getConnectedAt() { + return connectedAt; + } + + public void setConnectedAt(long connectedAt) { + this.connectedAt = connectedAt; + } + + public String getConnectionId() { + return connectionId; + } + + public void setConnectionId(String connectionId) { + this.connectionId = connectionId; + } + + public String getDomainName() { + return domainName; + } + + public void setDomainName(String domainName) { + this.domainName = domainName; + } + + public String getError() { + return error; + } + + public void setError(String error) { + this.error = error; + } + + 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 getIntegrationLatency() { + return integrationLatency; + } + + public void setIntegrationLatency(String integrationLatency) { + this.integrationLatency = integrationLatency; + } + + public String getMessageDirection() { + return messageDirection; + } + + 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 ((this.accountId == null) ? (other.accountId != null) : !this.accountId.equals(other.accountId)) { + return false; + } + if ((this.resourceId == null) ? (other.resourceId != null) : !this.resourceId.equals(other.resourceId)) { + return false; + } + if ((this.stage == null) ? (other.stage != null) : !this.stage.equals(other.stage)) { + return false; + } + if ((this.requestId == null) ? (other.requestId != null) : !this.requestId.equals(other.requestId)) { + return false; + } + if ((this.ResourcePath == null) ? (other.ResourcePath != null) : !this.ResourcePath.equals(other.ResourcePath)) { + return false; + } + if ((this.authorizer == null) ? (other.authorizer != null) : !this.authorizer.equals(other.authorizer)) { + return false; + } + if ((this.httpMethod == null) ? (other.httpMethod != null) : !this.httpMethod.equals(other.httpMethod)) { + return false; + } + if ((this.apiId == null) ? (other.apiId != null) : !this.apiId.equals(other.apiId)) { + return false; + } + if ((this.connectionId == null) ? (other.connectionId != null) : !this.connectionId.equals(other.connectionId)) { + return false; + } + if ((this.domainName == null) ? (other.domainName != null) : !this.domainName.equals(other.domainName)) { + return false; + } + if ((this.error == null) ? (other.error != null) : !this.error.equals(other.error)) { + return false; + } + 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; + } + + } + + 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; + + public String getResource() { + return resource; + } + + public void setResource(String resource) { + this.resource = resource; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public String getHttpMethod() { + return httpMethod; + } + + public void setHttpMethod(String httpMethod) { + this.httpMethod = httpMethod; + } + + public Map getHeaders() { + return headers; + } + + public void setHeaders(Map headers) { + this.headers = headers; + } + + public Map> getMultiValueHeaders() { + return multiValueHeaders; + } + + public void setMultiValueHeaders(Map> multiValueHeaders) { + this.multiValueHeaders = multiValueHeaders; + } + + public Map getQueryStringParameters() { + return queryStringParameters; + } + + public void setQueryStringParameters(Map queryStringParameters) { + this.queryStringParameters = queryStringParameters; + } + + public Map> getMultiValueQueryStringParameters() { + return multiValueQueryStringParameters; + } + + public void setMultiValueQueryStringParameters(Map> multiValueQueryStringParameters) { + this.multiValueQueryStringParameters = multiValueQueryStringParameters; + } + + public Map getPathParameters() { + return pathParameters; + } + + public void setPathParameters(Map pathParameters) { + this.pathParameters = pathParameters; + } + + public Map getStageVariables() { + return stageVariables; + } + + public void setStageVariables(Map stageVariables) { + this.stageVariables = stageVariables; + } + + 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 APIGatewayV2WebSocketEvent other = (APIGatewayV2WebSocketEvent) 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; + } + + @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/APIGatewayV2WebSocketResponse.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2WebSocketResponse.java new file mode 100644 index 00000000..87e4284c --- /dev/null +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2WebSocketResponse.java @@ -0,0 +1,110 @@ +package com.amazonaws.services.lambda.runtime.events; + +import java.io.Serializable; +import java.util.Map; + +/** + * @author Tim Gustafson + */ +public class APIGatewayV2WebSocketResponse implements Serializable, Cloneable { + + private static final long serialVersionUID = -5155789062248356200L; + + private boolean isBase64Encoded = false; + private int statusCode; + private Map headers; + private Map multiValueHeaders; + private String body; + + public boolean isIsBase64Encoded() { + return isBase64Encoded; + } + + public void setIsBase64Encoded(boolean isBase64Encoded) { + this.isBase64Encoded = isBase64Encoded; + } + + public int getStatusCode() { + return statusCode; + } + + public void setStatusCode(int statusCode) { + this.statusCode = statusCode; + } + + public Map getHeaders() { + return headers; + } + + public void setHeaders(Map headers) { + this.headers = headers; + } + + public Map getMultiValueHeaders() { + return multiValueHeaders; + } + + 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 = 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; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final APIGatewayV2WebSocketResponse other = (APIGatewayV2WebSocketResponse) obj; + if (this.isBase64Encoded != other.isBase64Encoded) { + return false; + } + if (this.statusCode != other.statusCode) { + return false; + } + if ((this.body == null) ? (other.body != null) : !this.body.equals(other.body)) { + return false; + } + 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() { + return "{isBase64Encoded=" + isBase64Encoded + + ", statusCode=" + statusCode + + ", headers=" + headers + + ", multiValueHeaders=" + multiValueHeaders + + ", body=" + body + + "}"; + } + +}