diff --git a/aws-lambda-java-events/pom.xml b/aws-lambda-java-events/pom.xml index a0f25dc5..a13e94b0 100644 --- a/aws-lambda-java-events/pom.xml +++ b/aws-lambda-java-events/pom.xml @@ -1,11 +1,11 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.amazonaws aws-lambda-java-events - 3.11.0 + 4.0.0 jar AWS Lambda Java Events Library @@ -34,6 +34,7 @@ 1.8 1.8 + 5.8.2 1.18.22 @@ -46,30 +47,23 @@ - joda-time - joda-time - 2.6 + com.amazonaws + aws-lambda-java-serialization + 2.0.0 + + + com.google.code.gson + gson + + org.junit.jupiter junit-jupiter-engine - 5.7.0 + ${junit.version} test - - com.fasterxml.jackson.core - jackson-databind - 2.10.5.1 - test - - - net.javacrumbs.json-unit - json-unit-assertj - 2.22.0 - test - - org.projectlombok lombok diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayProxyRequestEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayProxyRequestEvent.java deleted file mode 100644 index 042a481a..00000000 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayProxyRequestEvent.java +++ /dev/null @@ -1,1358 +0,0 @@ -package com.amazonaws.services.lambda.runtime.events; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; - -/** - * Class that represents an APIGatewayProxyRequestEvent - */ -public class APIGatewayProxyRequestEvent implements Serializable, Cloneable { - - private static final long serialVersionUID = 4189228800688527467L; - - private String version; - - 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 ProxyRequestContext requestContext; - - private String body; - - private Boolean isBase64Encoded; - - /** - * class that represents proxy request context - */ - public static class ProxyRequestContext implements Serializable, Cloneable { - - private static final long serialVersionUID = 8783459961042799774L; - - private String accountId; - - private String stage; - - private String resourceId; - - private String requestId; - - private String operationName; - - private RequestIdentity identity; - - private String resourcePath; - - private String httpMethod; - - private String apiId; - - private String path; - - private Map authorizer; - - /** - * default constructor - */ - public ProxyRequestContext() {} - - /** - * @return account id that owns Lambda function - */ - public String getAccountId() { - return accountId; - } - - /** - * @param accountId account id that owns Lambda function - */ - public void setAccountId(String accountId) { - this.accountId = accountId; - } - - /** - * @param accountId account id that owns Lambda function - * @return ProxyRequestContext object - */ - public ProxyRequestContext withAccountId(String accountId) { - this.setAccountId(accountId); - return this; - } - - public Map getAuthorizer() { - return authorizer; - } - - public void setAuthorizer(final Map authorizer) { - this.authorizer = authorizer; - } - - /** - * @return API Gateway stage name - */ - public String getStage() { - return stage; - } - - /** - * @param stage API Gateway stage name - */ - public void setStage(String stage) { - this.stage = stage; - } - - /** - * @param stage API Gateway stage name - * @return ProxyRequestContext object - */ - public ProxyRequestContext withStage(String stage) { - this.setStage(stage); - return this; - } - - /** - * @return resource id - */ - public String getResourceId() { - return resourceId; - } - - /** - * @param resourceId resource id - */ - public void setResourceId(String resourceId) { - this.resourceId = resourceId; - } - - /** - * @param resourceId resource id - * @return ProxyRequestContext object - */ - public ProxyRequestContext withResourceId(String resourceId) { - this.setResourceId(resourceId); - return this; - } - - /** - * @return unique request id - */ - public String getRequestId() { - return requestId; - } - - /** - * @param requestId unique request id - */ - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - /** - * @param requestId unique request id - * @return ProxyRequestContext object - */ - public ProxyRequestContext withRequestId(String requestId) { - this.setRequestId(requestId); - return this; - } - - /** - * @return The identity information for the request caller - */ - public RequestIdentity getIdentity() { - return identity; - } - - /** - * @param identity The identity information for the request caller - */ - public void setIdentity(RequestIdentity identity) { - this.identity = identity; - } - - /** - * @param identity The identity information for the request caller - * @return ProxyRequestContext object - */ - public ProxyRequestContext withIdentity(RequestIdentity identity) { - this.setIdentity(identity); - return this; - } - - /** - * @return The resource path defined in API Gateway - */ - public String getResourcePath() { - return resourcePath; - } - - /** - * @param resourcePath The resource path defined in API Gateway - */ - public void setResourcePath(String resourcePath) { - this.resourcePath = resourcePath; - } - - /** - * @param resourcePath The resource path defined in API Gateway - * @return ProxyRequestContext object - */ - public ProxyRequestContext withResourcePath(String resourcePath) { - this.setResourcePath(resourcePath); - return this; - } - - /** - * @return The HTTP method used - */ - public String getHttpMethod() { - return httpMethod; - } - - /** - * @param httpMethod the HTTP method used - */ - public void setHttpMethod(String httpMethod) { - this.httpMethod = httpMethod; - } - - /** - * @param httpMethod the HTTP method used - * @return ProxyRequestContext object - */ - public ProxyRequestContext withHttpMethod(String httpMethod) { - this.setHttpMethod(httpMethod); - return this; - } - - /** - * @return The API Gateway rest API Id. - */ - public String getApiId() { - return apiId; - } - - /** - * @param apiId The API Gateway rest API Id. - */ - public void setApiId(String apiId) { - this.apiId = apiId; - } - - /** - * @param apiId The API Gateway rest API Id - * @return ProxyRequestContext object - */ - public ProxyRequestContext withApiId(String apiId) { - this.setApiId(apiId); - return this; - } - - /** - * @return The API Gateway path (Does not include base url) - */ - public String getPath() { - return this.path; - } - - /** - * @param path The API Gateway path (Does not include base url) - */ - public void setPath(String path) { - this.path = path; - } - - /** - * @param path The API Gateway path (Does not include base url) - * @return ProxyRequestContext object - */ - public ProxyRequestContext withPath(String path) { - this.setPath(path); - return this; - } - - /** - * @return The name of the operation being performed - * */ - public String getOperationName() { - return operationName; - } - - /** - * @param operationName The name of the operation being performed - * */ - public void setOperationName(String operationName) { - this.operationName = operationName; - } - - public ProxyRequestContext withOperationName(String operationName) { - this.setOperationName(operationName); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getAccountId() != null) - sb.append("accountId: ").append(getAccountId()).append(","); - if (getResourceId() != null) - sb.append("resourceId: ").append(getResourceId()).append(","); - if (getStage() != null) - sb.append("stage: ").append(getStage()).append(","); - if (getRequestId() != null) - sb.append("requestId: ").append(getRequestId()).append(","); - if (getIdentity() != null) - sb.append("identity: ").append(getIdentity().toString()).append(","); - if (getResourcePath() != null) - sb.append("resourcePath: ").append(getResourcePath()).append(","); - if (getHttpMethod() != null) - sb.append("httpMethod: ").append(getHttpMethod()).append(","); - if (getApiId() != null) - sb.append("apiId: ").append(getApiId()).append(","); - if (getPath() != null) - sb.append("path: ").append(getPath()).append(","); - if (getAuthorizer() != null) - sb.append("authorizer: ").append(getAuthorizer().toString()); - if (getOperationName() != null) - sb.append("operationName: ").append(getOperationName().toString()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof ProxyRequestContext == false) - return false; - ProxyRequestContext other = (ProxyRequestContext) obj; - if (other.getAccountId() == null ^ this.getAccountId() == null) - return false; - if (other.getAccountId() != null && other.getAccountId().equals(this.getAccountId()) == false) - return false; - if (other.getResourceId() == null ^ this.getResourceId() == null) - return false; - if (other.getResourceId() != null && other.getResourceId().equals(this.getResourceId()) == false) - return false; - if (other.getStage() == null ^ this.getStage() == null) - return false; - if (other.getStage() != null && other.getStage().equals(this.getStage()) == false) - return false; - if (other.getRequestId() == null ^ this.getRequestId() == null) - return false; - if (other.getRequestId() != null && other.getRequestId().equals(this.getRequestId()) == false) - return false; - if (other.getIdentity() == null ^ this.getIdentity() == null) - return false; - if (other.getIdentity() != null && other.getIdentity().equals(this.getIdentity()) == false) - return false; - if (other.getResourcePath() == null ^ this.getResourcePath() == null) - return false; - if (other.getResourcePath() != null && other.getResourcePath().equals(this.getResourcePath()) == false) - return false; - if (other.getHttpMethod() == null ^ this.getHttpMethod() == null) - return false; - if (other.getHttpMethod() != null && other.getHttpMethod().equals(this.getHttpMethod()) == false) - return false; - if (other.getApiId() == null ^ this.getApiId() == null) - return false; - if (other.getApiId() != null && other.getApiId().equals(this.getApiId()) == false) - return false; - if (other.getPath() == null ^ this.getPath() == null) - return false; - if (other.getPath() != null && other.getPath().equals(this.getPath()) == false) - return false; - if (other.getAuthorizer() == null ^ this.getAuthorizer() == null) - return false; - if (other.getAuthorizer() != null && !other.getAuthorizer().equals(this.getAuthorizer())) - return false; - if (other.getOperationName() == null ^ this.getOperationName() == null) - return false; - if (other.getOperationName() != null && !other.getOperationName().equals(this.getOperationName())) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getAccountId() == null) ? 0 : getAccountId().hashCode()); - hashCode = prime * hashCode + ((getResourceId() == null) ? 0 : getResourceId().hashCode()); - hashCode = prime * hashCode + ((getStage() == null) ? 0 : getStage().hashCode()); - hashCode = prime * hashCode + ((getRequestId() == null) ? 0 : getRequestId().hashCode()); - hashCode = prime * hashCode + ((getIdentity() == null) ? 0 : getIdentity().hashCode()); - hashCode = prime * hashCode + ((getResourcePath() == null) ? 0 : getResourcePath().hashCode()); - hashCode = prime * hashCode + ((getHttpMethod() == null) ? 0 : getHttpMethod().hashCode()); - hashCode = prime * hashCode + ((getApiId() == null) ? 0 : getApiId().hashCode()); - hashCode = prime * hashCode + ((getPath() == null) ? 0 : getPath().hashCode()); - hashCode = prime * hashCode + ((getAuthorizer() == null) ? 0 : getAuthorizer().hashCode()); - hashCode = prime * hashCode + ((getOperationName() == null) ? 0: getOperationName().hashCode()); - return hashCode; - } - - @Override - public ProxyRequestContext clone() { - try { - return (ProxyRequestContext) super.clone(); - } catch (CloneNotSupportedException e) { - throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e); - } - } - } - - public static class RequestIdentity implements Serializable, Cloneable { - - private static final long serialVersionUID = -5283829736983640346L; - - private String cognitoIdentityPoolId; - - private String accountId; - - private String cognitoIdentityId; - - private String caller; - - private String apiKey; - - private String principalOrgId; - - private String sourceIp; - - private String cognitoAuthenticationType; - - private String cognitoAuthenticationProvider; - - private String userArn; - - private String userAgent; - - private String user; - - private String accessKey; - - /** - * default constructor - */ - public RequestIdentity() {} - - /** - * @return The Cognito identity pool id. - */ - public String getCognitoIdentityPoolId() { - return cognitoIdentityPoolId; - } - - /** - * @param cognitoIdentityPoolId The Cognito identity pool id. - */ - public void setCognitoIdentityPoolId(String cognitoIdentityPoolId) { - this.cognitoIdentityPoolId = cognitoIdentityPoolId; - } - - /** - * @param cognitoIdentityPoolId The Cognito Identity pool id - * @return RequestIdentity object - */ - public RequestIdentity withCognitoIdentityPoolId(String cognitoIdentityPoolId) { - this.setCognitoIdentityPoolId(cognitoIdentityPoolId); - return this; - } - - /** - * @return The account id that owns the executing Lambda function - */ - public String getAccountId() { - return accountId; - } - - /** - * @param accountId The account id that owns the executing Lambda function - */ - public void setAccountId(String accountId) { - this.accountId = accountId; - } - - /** - * @param accountId The account id that owns the executing Lambda function - * @return RequestIdentity object - */ - public RequestIdentity withAccountId(String accountId) { - this.setAccountId(accountId); - return this; - } - - /** - * @return The cognito identity id. - */ - public String getCognitoIdentityId() { - return cognitoIdentityId; - } - - /** - * @param cognitoIdentityId The cognito identity id. - */ - public void setCognitoIdentityId(String cognitoIdentityId) { - this.cognitoIdentityId = cognitoIdentityId; - } - - /** - * @param cognitoIdentityId The cognito identity id - * @return RequestIdentity object - */ - public RequestIdentity withCognitoIdentityId(String cognitoIdentityId) { - this.setCognitoIdentityId(cognitoIdentityId); - return this; - } - - /** - * @return the caller - */ - public String getCaller() { - return caller; - } - - /** - * @param caller the caller - */ - public void setCaller(String caller) { - this.caller = caller; - } - - /** - * @param caller the caller - * @return RequestIdentity object - */ - public RequestIdentity withCaller(String caller) { - this.setCaller(caller); - return this; - } - - /** - * @return the api key - */ - public String getApiKey() { - return apiKey; - } - - /** - * @param apiKey the api key - */ - public void setApiKey(String apiKey) { - this.apiKey = apiKey; - } - - /** - * @param apiKey the api key - * @return RequestIdentity object - */ - public RequestIdentity withApiKey(String apiKey) { - this.setApiKey(apiKey); - return this; - } - - /** - * @return the principal org Id - */ - public String getPrincipalOrgId() { - return principalOrgId; - } - - /** - * @param principalOrgId the principal org Id - */ - public void setPrincipalOrgId(String principalOrgId) { - this.principalOrgId = principalOrgId; - } - - /** - * @param principalOrgId the principal org Id - * @return RequestIdentity object - */ - public RequestIdentity withPrincipalOrgId(String principalOrgId) { - this.setPrincipalOrgId(principalOrgId); - return this; - } - - /** - * @return source ip address - */ - public String getSourceIp() { - return sourceIp; - } - - /** - * @param sourceIp source ip address - */ - public void setSourceIp(String sourceIp) { - this.sourceIp = sourceIp; - } - - /** - * @param sourceIp source ip address - * @return RequestIdentity object - */ - public RequestIdentity withSourceIp(String sourceIp) { - this.setSourceIp(sourceIp); - return this; - } - - /** - * @return The Cognito authentication type used for authentication - */ - public String getCognitoAuthenticationType() { - return cognitoAuthenticationType; - } - - /** - * @param cognitoAuthenticationType The Cognito authentication type used for authentication - */ - public void setCognitoAuthenticationType(String cognitoAuthenticationType) { - this.cognitoAuthenticationType = cognitoAuthenticationType; - } - - /** - * @param cognitoAuthenticationType The Cognito authentication type used for authentication - * @return - */ - public RequestIdentity withCognitoAuthenticationType(String cognitoAuthenticationType) { - this.setCognitoAuthenticationType(cognitoAuthenticationType); - return this; - } - - /** - * @return The Cognito authentication provider - */ - public String getCognitoAuthenticationProvider() { - return cognitoAuthenticationProvider; - } - - /** - * @param cognitoAuthenticationProvider The Cognito authentication provider - */ - public void setCognitoAuthenticationProvider(String cognitoAuthenticationProvider) { - this.cognitoAuthenticationProvider = cognitoAuthenticationProvider; - } - - /** - * @param cognitoAuthenticationProvider The Cognito authentication provider - * @return RequestIdentity object - */ - public RequestIdentity withCognitoAuthenticationProvider(String cognitoAuthenticationProvider) { - this.setCognitoAuthenticationProvider(cognitoAuthenticationProvider); - return this; - } - - /** - * @return the user arn - */ - public String getUserArn() { - return userArn; - } - - /** - * @param userArn user arn - */ - public void setUserArn(String userArn) { - this.userArn = userArn; - } - - /** - * @param userArn user arn - * @return RequestIdentity object - */ - public RequestIdentity withUserArn(String userArn) { - this.setUserArn(userArn); - return this; - } - - /** - * @return user agent - */ - public String getUserAgent() { - return userAgent; - } - - /** - * @param userAgent user agent - */ - public void setUserAgent(String userAgent) { - this.userAgent = userAgent; - } - - /** - * @param userAgent user agent - * @return RequestIdentityType - */ - public RequestIdentity withUserAgent(String userAgent) { - this.setUserAgent(userAgent); - return this; - } - - /** - * @return user - */ - public String getUser() { - return user; - } - - /** - * @param user user - */ - public void setUser(String user) { - this.user = user; - } - - /** - * @param user user - * @return RequestIdentity - */ - public RequestIdentity withUser(String user) { - this.setUser(user); - return this; - } - - /** - * @return access key - */ - public String getAccessKey() { - return this.accessKey; - } - - /** - * @param accessKey Cognito access key - */ - public void setAccessKey(String accessKey) { - this.accessKey = accessKey; - } - - /** - * @param accessKey Cognito access key - * @return RequestIdentity - */ - public RequestIdentity withAccessKey(String accessKey) { - this.setAccessKey(accessKey); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getCognitoIdentityPoolId() != null) - sb.append("cognitoIdentityPoolId: ").append(getCognitoIdentityPoolId()).append(","); - if (getAccountId() != null) - sb.append("accountId: ").append(getAccountId()).append(","); - if (getCognitoIdentityId() != null) - sb.append("cognitoIdentityId: ").append(getCognitoIdentityId()).append(","); - if (getCaller() != null) - sb.append("caller: ").append(getCaller()).append(","); - if (getApiKey() != null) - sb.append("apiKey: ").append(getApiKey()).append(","); - if (getPrincipalOrgId() != null) - sb.append("principalOrgId: ").append(getPrincipalOrgId()).append(","); - if (getSourceIp() != null) - sb.append("sourceIp: ").append(getSourceIp()).append(","); - if (getCognitoAuthenticationType() != null) - sb.append("eventTriggerConfigId: ").append(getCognitoAuthenticationType()).append(","); - if (getCognitoAuthenticationProvider() != null) - sb.append("cognitoAuthenticationProvider: ").append(getCognitoAuthenticationProvider()).append(","); - if (getUserArn() != null) - sb.append("userArn: ").append(getUserArn()).append(","); - if (getUserAgent() != null) - sb.append("userAgent: ").append(getUserAgent()).append(","); - if (getUser() != null) - sb.append("user: ").append(getUser()).append(","); - if (getAccessKey() != null) - sb.append("accessKey: ").append(getAccessKey()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof RequestIdentity == false) - return false; - RequestIdentity other = (RequestIdentity) obj; - if (other.getCognitoIdentityPoolId() == null ^ this.getCognitoIdentityPoolId() == null) - return false; - if (other.getCognitoIdentityPoolId() != null && other.getCognitoIdentityPoolId().equals(this.getCognitoIdentityPoolId()) == false) - return false; - if (other.getAccountId() == null ^ this.getAccountId() == null) - return false; - if (other.getAccountId() != null && other.getAccountId().equals(this.getAccountId()) == false) - return false; - if (other.getCognitoIdentityId() == null ^ this.getCognitoIdentityId() == null) - return false; - if (other.getCognitoIdentityId() != null && other.getCognitoIdentityId().equals(this.getCognitoIdentityId()) == false) - return false; - if (other.getCaller() == null ^ this.getCaller() == null) - return false; - if (other.getCaller() != null && other.getCaller().equals(this.getCaller()) == false) - return false; - if (other.getApiKey() == null ^ this.getApiKey() == null) - return false; - if (other.getApiKey() != null && other.getApiKey().equals(this.getApiKey()) == false) - return false; - if (other.getPrincipalOrgId() == null ^ this.getPrincipalOrgId() == null) - return false; - if (other.getPrincipalOrgId() != null && other.getPrincipalOrgId().equals(this.getPrincipalOrgId()) == false) - return false; - if (other.getSourceIp() == null ^ this.getSourceIp() == null) - return false; - if (other.getSourceIp() != null && other.getSourceIp().equals(this.getSourceIp()) == false) - return false; - if (other.getCognitoAuthenticationType() == null ^ this.getCognitoAuthenticationType() == null) - return false; - if (other.getCognitoAuthenticationType() != null && other.getCognitoAuthenticationType().equals(this.getCognitoAuthenticationType()) == false) - return false; - if (other.getCognitoAuthenticationProvider() == null ^ this.getCognitoAuthenticationProvider() == null) - return false; - if (other.getCognitoAuthenticationProvider() != null && other.getCognitoAuthenticationProvider().equals(this.getCognitoAuthenticationProvider()) == false) - return false; - if (other.getUserArn() == null ^ this.getUserArn() == null) - return false; - if (other.getUserArn() != null && other.getUserArn().equals(this.getUserArn()) == false) - return false; - if (other.getUserAgent() == null ^ this.getUserAgent() == null) - return false; - if (other.getUserAgent() != null && other.getUserAgent().equals(this.getUserAgent()) == false) - return false; - if (other.getUser() == null ^ this.getUser() == null) - return false; - if (other.getUser() != null && other.getUser().equals(this.getUser()) == false) - return false; - if (other.getAccessKey() == null ^ this.getAccessKey() == null) - return false; - if (other.getAccessKey() != null && other.getAccessKey().equals(this.getAccessKey()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getCognitoIdentityPoolId() == null) ? 0 : getCognitoIdentityPoolId().hashCode()); - hashCode = prime * hashCode + ((getAccountId() == null) ? 0 : getAccountId().hashCode()); - hashCode = prime * hashCode + ((getCognitoIdentityId() == null) ? 0 : getCognitoIdentityId().hashCode()); - hashCode = prime * hashCode + ((getCognitoIdentityId() == null) ? 0 : getCognitoIdentityId().hashCode()); - hashCode = prime * hashCode + ((getCaller() == null) ? 0 : getCaller().hashCode()); - hashCode = prime * hashCode + ((getApiKey() == null) ? 0 : getApiKey().hashCode()); - hashCode = prime * hashCode + ((getPrincipalOrgId() == null) ? 0 : getPrincipalOrgId().hashCode()); - hashCode = prime * hashCode + ((getSourceIp() == null) ? 0 : getSourceIp().hashCode()); - hashCode = prime * hashCode + ((getCognitoAuthenticationType() == null) ? 0 : getCognitoAuthenticationType().hashCode()); - hashCode = prime * hashCode + ((getCognitoAuthenticationProvider() == null) ? 0 : getCognitoAuthenticationProvider().hashCode()); - hashCode = prime * hashCode + ((getUserArn() == null) ? 0 : getUserArn().hashCode()); - hashCode = prime * hashCode + ((getUserAgent() == null) ? 0 : getUserAgent().hashCode()); - hashCode = prime * hashCode + ((getUser() == null) ? 0 : getUser().hashCode()); - hashCode = prime * hashCode + ((getAccessKey() == null) ? 0 : getAccessKey().hashCode()); - return hashCode; - } - - @Override - public RequestIdentity clone() { - try { - return (RequestIdentity) super.clone(); - } catch (CloneNotSupportedException e) { - throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e); - } - } - } - - /** - * default constructor - */ - public APIGatewayProxyRequestEvent() {} - - /** - * @return The payload format version - */ - public String getVersion() { - return version; - } - - /** - * @param version The payload format version - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * @param version The payload format version - * @return - */ - public APIGatewayProxyRequestEvent withVersion(String version) { - this.setVersion(version); - return this; - } - - /** - * @return The resource path defined in API Gateway - */ - public String getResource() { - return resource; - } - - /** - * @param resource The resource path defined in API Gateway - */ - public void setResource(String resource) { - this.resource = resource; - } - - /** - * @param resource The resource path defined in API Gateway - * @return - */ - public APIGatewayProxyRequestEvent withResource(String resource) { - this.setResource(resource); - return this; - } - - /** - * @return The url path for the caller - */ - public String getPath() { - return path; - } - - /** - * @param path The url path for the caller - */ - public void setPath(String path) { - this.path = path; - } - - /** - * @param path The url path for the caller - * @return APIGatewayProxyRequestEvent object - */ - public APIGatewayProxyRequestEvent withPath(String path) { - this.setPath(path); - return this; - } - - /** - * @return The HTTP method used - */ - public String getHttpMethod() { - return httpMethod; - } - - /** - * @param httpMethod The HTTP method used - */ - public void setHttpMethod(String httpMethod) { - this.httpMethod = httpMethod; - } - - /** - * @param httpMethod The HTTP method used - * @return APIGatewayProxyRequestEvent - */ - public APIGatewayProxyRequestEvent withHttpMethod(String httpMethod) { - this.setHttpMethod(httpMethod); - return this; - } - - /** - * @return The headers sent with the request - */ - public Map getHeaders() { - return headers; - } - - /** - * @param headers The headers sent with the request - */ - public void setHeaders(Map headers) { - this.headers = headers; - } - - /** - * @param headers The headers sent with the request - * @return APIGatewayProxyRequestEvent object - */ - public APIGatewayProxyRequestEvent withHeaders(Map headers) { - this.setHeaders(headers); - return this; - } - - /** - * @return The multi value headers sent with the request - */ - public Map> getMultiValueHeaders() { - return multiValueHeaders; - } - - /** - * @param multiValueHeaders The multi value headers sent with the request - */ - public void setMultiValueHeaders(Map> multiValueHeaders) { - this.multiValueHeaders = multiValueHeaders; - } - - /** - * @param multiValueHeaders The multi value headers sent with the request - * @return APIGatewayProxyRequestEvent object - */ - public APIGatewayProxyRequestEvent withMultiValueHeaders(Map> multiValueHeaders) { - this.setMultiValueHeaders(multiValueHeaders); - return this; - } - - /** - * @return The query string parameters that were part of the request - */ - public Map getQueryStringParameters() { - return queryStringParameters; - } - - /** - * @param queryStringParameters The query string parameters that were part of the request - */ - public void setQueryStringParameters(Map queryStringParameters) { - this.queryStringParameters = queryStringParameters; - } - - /** - * @param queryStringParameters The query string parameters that were part of the request - * @return APIGatewayProxyRequestEvent - */ - public APIGatewayProxyRequestEvent withQueryStringParameters(Map queryStringParameters) { - this.setQueryStringParameters(queryStringParameters); - return this; - } - - /** - * @deprecated Because of typo in method's name, use {@link #withQueryStringParameters} instead. - */ - @Deprecated - public APIGatewayProxyRequestEvent withQueryStringParamters(Map queryStringParameters) { - return withQueryStringParameters(queryStringParameters); - } - - /** - * @return The multi value query string parameters that were part of the request - */ - public Map> getMultiValueQueryStringParameters() { - return multiValueQueryStringParameters; - } - - /** - * @param multiValueQueryStringParameters The multi value query string parameters that were part of the request - */ - public void setMultiValueQueryStringParameters(Map> multiValueQueryStringParameters) { - this.multiValueQueryStringParameters = multiValueQueryStringParameters; - } - - /** - * @param multiValueQueryStringParameters The multi value query string parameters that were part of the request - * @return APIGatewayProxyRequestEvent - */ - public APIGatewayProxyRequestEvent withMultiValueQueryStringParameters(Map> multiValueQueryStringParameters) { - this.setMultiValueQueryStringParameters(multiValueQueryStringParameters); - return this; - } - - /** - * @return The path parameters that were part of the request - */ - public Map getPathParameters() { - return pathParameters; - } - - /** - * @param pathParameters The path parameters that were part of the request - */ - public void setPathParameters(Map pathParameters) { - this.pathParameters = pathParameters; - } - - /** - * @param pathParameters The path parameters that were part of the request - * @return APIGatewayProxyRequestEvent object - */ - public APIGatewayProxyRequestEvent withPathParameters(Map pathParameters) { - this.setPathParameters(pathParameters); - return this; - } - - /** - * @deprecated Because of typo in method's name, use {@link #withPathParameters} instead. - */ - @Deprecated - public APIGatewayProxyRequestEvent withPathParamters(Map pathParameters) { - return withPathParameters(pathParameters); - } - - /** - * @return The stage variables defined for the stage in API Gateway - */ - public Map getStageVariables() { - return stageVariables; - } - - /** - * @param stageVariables The stage variables defined for the stage in API Gateway - */ - public void setStageVariables(Map stageVariables) { - this.stageVariables = stageVariables; - } - - /** - * @param stageVariables The stage variables defined for the stage in API Gateway - * @return APIGatewayProxyRequestEvent - */ - public APIGatewayProxyRequestEvent withStageVariables(Map stageVariables) { - this.setStageVariables(stageVariables); - return this; - } - - /** - * @return The request context for the request - */ - public ProxyRequestContext getRequestContext() { - return requestContext; - } - - /** - * @param requestContext The request context for the request - */ - public void setRequestContext(ProxyRequestContext requestContext) { - this.requestContext = requestContext; - } - - /** - * @param requestContext The request context for the request - * @return APIGatewayProxyRequestEvent object - */ - public APIGatewayProxyRequestEvent withRequestContext(ProxyRequestContext requestContext) { - this.setRequestContext(requestContext); - return this; - } - - /** - * @return The HTTP request body. - */ - public String getBody() { - return body; - } - - /** - * @param body The HTTP request body. - */ - public void setBody(String body) { - this.body = body; - } - - /** - * @param body The HTTP request body - * @return APIGatewayProxyRequestEvent - */ - public APIGatewayProxyRequestEvent withBody(String body) { - this.setBody(body); - return this; - } - - /** - * @return whether the body String is base64 encoded. - */ - public Boolean getIsBase64Encoded() { - return this.isBase64Encoded; - } - - /** - * @param isBase64Encoded Whether the body String is base64 encoded - */ - public void setIsBase64Encoded(Boolean isBase64Encoded) { - this.isBase64Encoded = isBase64Encoded; - } - - /** - * @param isBase64Encoded Whether the body String is base64 encoded - * @return APIGatewayProxyRequestEvent - */ - public APIGatewayProxyRequestEvent withIsBase64Encoded(Boolean isBase64Encoded) { - this.setIsBase64Encoded(isBase64Encoded); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getVersion() != null) - sb.append("version: ").append(getVersion()).append(","); - if (getResource() != null) - sb.append("resource: ").append(getResource()).append(","); - if (getPath() != null) - sb.append("path: ").append(getPath()).append(","); - if (getHttpMethod() != null) - sb.append("httpMethod: ").append(getHttpMethod()).append(","); - if (getHeaders() != null) - sb.append("headers: ").append(getHeaders().toString()).append(","); - if (getMultiValueHeaders() != null) - sb.append("multiValueHeaders: ").append(getMultiValueHeaders().toString()).append(","); - if (getQueryStringParameters() != null) - sb.append("queryStringParameters: ").append(getQueryStringParameters().toString()).append(","); - if (getMultiValueQueryStringParameters() != null) - sb.append("multiValueQueryStringParameters: ").append(getMultiValueQueryStringParameters().toString()).append(","); - if (getPathParameters() != null) - sb.append("pathParameters: ").append(getPathParameters().toString()).append(","); - if (getStageVariables() != null) - sb.append("stageVariables: ").append(getStageVariables().toString()).append(","); - if (getRequestContext() != null) - sb.append("requestContext: ").append(getRequestContext().toString()).append(","); - if (getBody() != null) - sb.append("body: ").append(getBody()).append(","); - if (getIsBase64Encoded() != null) - sb.append("isBase64Encoded: ").append(getIsBase64Encoded()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof APIGatewayProxyRequestEvent == false) - return false; - APIGatewayProxyRequestEvent other = (APIGatewayProxyRequestEvent) obj; - if (other.getVersion() == null ^ this.getVersion() == null) - return false; - if (other.getVersion() != null && other.getVersion().equals(this.getVersion()) == false) - return false; - if (other.getResource() == null ^ this.getResource() == null) - return false; - if (other.getResource() != null && other.getResource().equals(this.getResource()) == false) - return false; - if (other.getPath() == null ^ this.getPath() == null) - return false; - if (other.getPath() != null && other.getPath().equals(this.getPath()) == false) - return false; - if (other.getHttpMethod() == null ^ this.getHttpMethod() == null) - return false; - if (other.getHttpMethod() != null && other.getHttpMethod().equals(this.getHttpMethod()) == false) - return false; - if (other.getHeaders() == null ^ this.getHeaders() == null) - return false; - if (other.getHeaders() != null && other.getHeaders().equals(this.getHeaders()) == false) - return false; - if (other.getMultiValueHeaders() == null ^ this.getMultiValueHeaders() == null) - return false; - if (other.getMultiValueHeaders() != null && other.getMultiValueHeaders().equals(this.getMultiValueHeaders()) == false) - return false; - if (other.getQueryStringParameters() == null ^ this.getQueryStringParameters() == null) - return false; - if (other.getQueryStringParameters() != null && other.getQueryStringParameters().equals(this.getQueryStringParameters()) == false) - return false; - if (other.getMultiValueQueryStringParameters() == null ^ this.getMultiValueQueryStringParameters() == null) - return false; - if (other.getMultiValueQueryStringParameters() != null && other.getMultiValueQueryStringParameters().equals(this.getMultiValueQueryStringParameters()) == false) - return false; - if (other.getPathParameters() == null ^ this.getPathParameters() == null) - return false; - if (other.getPathParameters() != null && other.getPathParameters().equals(this.getPathParameters()) == false) - return false; - if (other.getStageVariables() == null ^ this.getStageVariables() == null) - return false; - if (other.getStageVariables() != null && other.getStageVariables().equals(this.getStageVariables()) == false) - return false; - if (other.getRequestContext() == null ^ this.getRequestContext() == null) - return false; - if (other.getRequestContext() != null && other.getRequestContext().equals(this.getRequestContext()) == false) - return false; - if (other.getBody() == null ^ this.getBody() == null) - return false; - if (other.getBody() != null && other.getBody().equals(this.getBody()) == false) - return false; - if (other.getIsBase64Encoded() == null ^ this.getIsBase64Encoded() == null) - return false; - if (other.getIsBase64Encoded() != null && other.getIsBase64Encoded().equals(this.getIsBase64Encoded()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getVersion() == null) ? 0 : getVersion().hashCode()); - hashCode = prime * hashCode + ((getResource() == null) ? 0 : getResource().hashCode()); - hashCode = prime * hashCode + ((getPath() == null) ? 0 : getPath().hashCode()); - hashCode = prime * hashCode + ((getHttpMethod() == null) ? 0 : getHttpMethod().hashCode()); - hashCode = prime * hashCode + ((getHeaders() == null) ? 0 : getHeaders().hashCode()); - hashCode = prime * hashCode + ((getMultiValueHeaders() == null) ? 0 : getMultiValueHeaders().hashCode()); - hashCode = prime * hashCode + ((getQueryStringParameters() == null) ? 0 : getQueryStringParameters().hashCode()); - hashCode = prime * hashCode + ((getMultiValueQueryStringParameters() == null) ? 0 : getMultiValueQueryStringParameters().hashCode()); - hashCode = prime * hashCode + ((getPathParameters() == null) ? 0 : getPathParameters().hashCode()); - hashCode = prime * hashCode + ((getStageVariables() == null) ? 0 : getStageVariables().hashCode()); - hashCode = prime * hashCode + ((getRequestContext() == null) ? 0 : getRequestContext().hashCode()); - hashCode = prime * hashCode + ((getBody() == null) ? 0 : getBody().hashCode()); - hashCode = prime * hashCode + ((getIsBase64Encoded() == null) ? 0 : getIsBase64Encoded().hashCode()); - return hashCode; - } - - @Override - public APIGatewayProxyRequestEvent clone() { - try { - return (APIGatewayProxyRequestEvent) super.clone(); - } catch (CloneNotSupportedException e) { - throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e); - } - } -} diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayProxyResponseEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayProxyResponseEvent.java deleted file mode 100644 index fb1f87c3..00000000 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayProxyResponseEvent.java +++ /dev/null @@ -1,218 +0,0 @@ -package com.amazonaws.services.lambda.runtime.events; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; - -/** - * Class that represents an APIGatewayProxyResponseEvent object - */ -public class APIGatewayProxyResponseEvent implements Serializable, Cloneable { - - private static final long serialVersionUID = 2263167344670024172L; - - private Integer statusCode; - - private Map headers; - - private Map> multiValueHeaders; - - private String body; - - private Boolean isBase64Encoded; - - /** - * default constructor - */ - public APIGatewayProxyResponseEvent() {} - - /** - * @return The HTTP status code for the request - */ - public Integer getStatusCode() { - return statusCode; - } - - /** - * @param statusCode The HTTP status code for the request - */ - public void setStatusCode(Integer statusCode) { - this.statusCode = statusCode; - } - - /** - * @param statusCode The HTTP status code for the request - * @return APIGatewayProxyResponseEvent object - */ - public APIGatewayProxyResponseEvent withStatusCode(Integer statusCode) { - this.setStatusCode(statusCode); - return this; - } - - /** - * @return The Http headers return in the response - */ - public Map getHeaders() { - return headers; - } - - /** - * @param headers The Http headers return in the response - */ - public void setHeaders(Map headers) { - this.headers = headers; - } - - /** - * @param headers The Http headers return in the response - * @return APIGatewayProxyResponseEvent - */ - public APIGatewayProxyResponseEvent withHeaders(Map headers) { - this.setHeaders(headers); - return this; - } - - /** - * @return the Http multi value headers to return in the response - */ - public Map> getMultiValueHeaders() { - return multiValueHeaders; - } - - /** - * @param multiValueHeaders the Http multi value headers to return in the response - */ - public void setMultiValueHeaders(Map> multiValueHeaders) { - this.multiValueHeaders = multiValueHeaders; - } - - /** - * - * @param multiValueHeaders the Http multi value headers to return in the response - * @return APIGatewayProxyResponseEvent - */ - public APIGatewayProxyResponseEvent withMultiValueHeaders(Map> multiValueHeaders) { - this.setMultiValueHeaders(multiValueHeaders); - return this; - } - - /** - * @return The response body - */ - public String getBody() { - return body; - } - - /** - * @param body The response body - */ - public void setBody(String body) { - this.body = body; - } - - /** - * @param body The response body - * @return APIGatewayProxyResponseEvent object - */ - public APIGatewayProxyResponseEvent withBody(String body) { - this.setBody(body); - return this; - } - - /** - * @return whether the body String is base64 encoded. - */ - public Boolean getIsBase64Encoded() { - return this.isBase64Encoded; - } - - /** - * @param isBase64Encoded Whether the body String is base64 encoded - */ - public void setIsBase64Encoded(Boolean isBase64Encoded) { - this.isBase64Encoded = isBase64Encoded; - } - - /** - * @param isBase64Encoded Whether the body String is base64 encoded - * @return APIGatewayProxyRequestEvent - */ - public APIGatewayProxyResponseEvent withIsBase64Encoded(Boolean isBase64Encoded) { - this.setIsBase64Encoded(isBase64Encoded); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getStatusCode() != null) - sb.append("statusCode: ").append(getStatusCode()).append(","); - if (getHeaders() != null) - sb.append("headers: ").append(getHeaders().toString()).append(","); - if (getMultiValueHeaders() != null) - sb.append("multiValueHeaders: ").append(getMultiValueHeaders().toString()).append(","); - if (getBody() != null) - sb.append("body: ").append(getBody()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof APIGatewayProxyResponseEvent == false) - return false; - APIGatewayProxyResponseEvent other = (APIGatewayProxyResponseEvent) obj; - if (other.getStatusCode() == null ^ this.getStatusCode() == null) - return false; - if (other.getStatusCode() != null && other.getStatusCode().equals(this.getStatusCode()) == false) - return false; - if (other.getHeaders() == null ^ this.getHeaders() == null) - return false; - if (other.getHeaders() != null && other.getHeaders().equals(this.getHeaders()) == false) - return false; - if (other.getMultiValueHeaders() == null ^ this.getMultiValueHeaders() == null) - return false; - if (other.getMultiValueHeaders() != null && other.getMultiValueHeaders().equals(this.getMultiValueHeaders()) == false) - return false; - if (other.getBody() == null ^ this.getBody() == null) - return false; - if (other.getBody() != null && other.getBody().equals(this.getBody()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getStatusCode() == null) ? 0 : getStatusCode().hashCode()); - hashCode = prime * hashCode + ((getHeaders() == null) ? 0 : getHeaders().hashCode()); - hashCode = prime * hashCode + ((getMultiValueHeaders() == null) ? 0 : getMultiValueHeaders().hashCode()); - hashCode = prime * hashCode + ((getBody() == null) ? 0 : getBody().hashCode()); - return hashCode; - } - - @Override - public APIGatewayProxyResponseEvent clone() { - try { - return (APIGatewayProxyResponseEvent) super.clone(); - } catch (CloneNotSupportedException e) { - throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e); - } - } - -} diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2CustomAuthorizerEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2CustomAuthorizerEvent.java deleted file mode 100644 index 6abfe051..00000000 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2CustomAuthorizerEvent.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.amazonaws.services.lambda.runtime.events; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.joda.time.DateTime; -import org.joda.time.format.DateTimeFormat; -import org.joda.time.format.DateTimeFormatter; - -import java.time.Instant; -import java.util.List; -import java.util.Map; - -/** - * The V2 API Gateway customer authorizer event object as described - https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html - * - */ - -@Data -@Builder(setterPrefix = "with") -@NoArgsConstructor -@AllArgsConstructor -public class APIGatewayV2CustomAuthorizerEvent { - - private String version; - private String type; - private String routeArn; - private List identitySource; - private String routeKey; - private String rawPath; - private String rawQueryString; - private List cookies; - private Map headers; - private Map queryStringParameters; - private RequestContext requestContext; - private Map pathParameters; - private Map stageVariables; - - @Data - @Builder(setterPrefix = "with") - @NoArgsConstructor - @AllArgsConstructor - public static class RequestContext { - - private static DateTimeFormatter fmt = DateTimeFormat.forPattern("dd/MMM/yyyy:HH:mm:ss Z"); - - private String accountId; - private String apiId; - private String domainName; - private String domainPrefix; - private Http http; - private String requestId; - private String routeKey; - private String stage; - private String time; - private long timeEpoch; - - public Instant getTimeEpoch() { - return Instant.ofEpochMilli(timeEpoch); - } - - public DateTime getTime() { - return fmt.parseDateTime(time); - } - } - - @AllArgsConstructor - @Builder(setterPrefix = "with") - @Data - @NoArgsConstructor - public static class Http { - - private String method; - private String path; - private String protocol; - private String sourceIp; - private String userAgent; - } -} \ No newline at end of file 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 deleted file mode 100644 index c8a64149..00000000 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyRequestEvent.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.amazonaws.services.lambda.runtime.events; - -/** - * @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) - */ -@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 deleted file mode 100644 index d920e784..00000000 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2ProxyResponseEvent.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.amazonaws.services.lambda.runtime.events; - -/** - * @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} - */ -@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 deleted file mode 100644 index cb6ffa99..00000000 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2WebSocketEvent.java +++ /dev/null @@ -1,727 +0,0 @@ -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 boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - APIGatewayV2WebSocketEvent that = (APIGatewayV2WebSocketEvent) o; - - if (isBase64Encoded != that.isBase64Encoded) return false; - if (resource != null ? !resource.equals(that.resource) : that.resource != null) return false; - if (path != null ? !path.equals(that.path) : that.path != null) return false; - if (httpMethod != null ? !httpMethod.equals(that.httpMethod) : that.httpMethod != null) return false; - if (headers != null ? !headers.equals(that.headers) : that.headers != null) return false; - if (multiValueHeaders != null ? !multiValueHeaders.equals(that.multiValueHeaders) : that.multiValueHeaders != null) - return false; - if (queryStringParameters != null ? !queryStringParameters.equals(that.queryStringParameters) : that.queryStringParameters != null) - return false; - if (multiValueQueryStringParameters != null ? !multiValueQueryStringParameters.equals(that.multiValueQueryStringParameters) : that.multiValueQueryStringParameters != null) - return false; - if (pathParameters != null ? !pathParameters.equals(that.pathParameters) : that.pathParameters != null) - return false; - if (stageVariables != null ? !stageVariables.equals(that.stageVariables) : that.stageVariables != null) - return false; - if (requestContext != null ? !requestContext.equals(that.requestContext) : that.requestContext != null) - return false; - return body != null ? body.equals(that.body) : that.body == null; - } - - @Override - public int hashCode() { - int result = resource != null ? resource.hashCode() : 0; - result = 31 * result + (path != null ? path.hashCode() : 0); - result = 31 * result + (httpMethod != null ? httpMethod.hashCode() : 0); - result = 31 * result + (headers != null ? headers.hashCode() : 0); - result = 31 * result + (multiValueHeaders != null ? multiValueHeaders.hashCode() : 0); - result = 31 * result + (queryStringParameters != null ? queryStringParameters.hashCode() : 0); - result = 31 * result + (multiValueQueryStringParameters != null ? multiValueQueryStringParameters.hashCode() : 0); - result = 31 * result + (pathParameters != null ? pathParameters.hashCode() : 0); - result = 31 * result + (stageVariables != null ? stageVariables.hashCode() : 0); - result = 31 * result + (requestContext != null ? requestContext.hashCode() : 0); - result = 31 * result + (body != null ? body.hashCode() : 0); - result = 31 * result + (isBase64Encoded ? 1 : 0); - return result; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("APIGatewayV2WebSocketEvent{"); - sb.append("resource='").append(resource).append('\''); - sb.append(", path='").append(path).append('\''); - sb.append(", httpMethod='").append(httpMethod).append('\''); - sb.append(", headers=").append(headers); - sb.append(", multiValueHeaders=").append(multiValueHeaders); - sb.append(", queryStringParameters=").append(queryStringParameters); - sb.append(", multiValueQueryStringParameters=").append(multiValueQueryStringParameters); - sb.append(", pathParameters=").append(pathParameters); - sb.append(", stageVariables=").append(stageVariables); - sb.append(", requestContext=").append(requestContext); - sb.append(", body='").append(body).append('\''); - sb.append(", isBase64Encoded=").append(isBase64Encoded); - 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 deleted file mode 100644 index 87e4284c..00000000 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2WebSocketResponse.java +++ /dev/null @@ -1,110 +0,0 @@ -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 - + "}"; - } - -} diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ActiveMQEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ActiveMQEvent.java index 46791980..380f7ee6 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ActiveMQEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ActiveMQEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -10,6 +10,7 @@ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ + package com.amazonaws.services.lambda.runtime.events; import lombok.AllArgsConstructor; @@ -17,12 +18,13 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; + import java.util.List; /** -* Represents an Active MQ event sent to Lambda -* Onboarding Amazon MQ as event source to Lambda -*/ + * Represents an Active MQ event sent to Lambda + * Onboarding Amazon MQ as event source to Lambda + */ @Data @NoArgsConstructor @AllArgsConstructor diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/AppSyncLambdaAuthorizerEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/AppSyncLambdaAuthorizerEvent.java index 3fae4d75..b9a1de96 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/AppSyncLambdaAuthorizerEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/AppSyncLambdaAuthorizerEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -10,6 +10,7 @@ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ + package com.amazonaws.services.lambda.runtime.events; import java.util.Map; @@ -40,7 +41,7 @@ public static class RequestContext { private String apiId; private String accountId; private String requestId; - private String queryDocument; + private String queryString; private String operationName; private Map variables; } diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/AppSyncLambdaAuthorizerResponse.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/AppSyncLambdaAuthorizerResponse.java index 4eec5aa3..dbd2ad56 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/AppSyncLambdaAuthorizerResponse.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/AppSyncLambdaAuthorizerResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -10,6 +10,7 @@ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ + package com.amazonaws.services.lambda.runtime.events; import java.util.Map; @@ -20,6 +21,8 @@ import lombok.Data; import lombok.NoArgsConstructor; +import com.fasterxml.jackson.annotation.JsonProperty; + /** * Class that represents the output from an AppSync Lambda authorizer invocation. */ @@ -29,8 +32,9 @@ @AllArgsConstructor public class AppSyncLambdaAuthorizerResponse { + @JsonProperty("isAuthorized") private boolean isAuthorized; private Map resolverContext; private List deniedFields; - private int ttlOverride; + private Integer ttlOverride; } \ No newline at end of file diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ApplicationLoadBalancerRequestEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ApplicationLoadBalancerRequestEvent.java index e7b33117..30a9c933 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ApplicationLoadBalancerRequestEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ApplicationLoadBalancerRequestEvent.java @@ -1,8 +1,25 @@ +/* + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with + * the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + package com.amazonaws.services.lambda.runtime.events; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import com.fasterxml.jackson.annotation.JsonProperty; + import java.io.Serializable; import java.util.List; import java.util.Map; @@ -15,21 +32,27 @@ * @author msailes */ -@NoArgsConstructor @Data -public class ApplicationLoadBalancerRequestEvent implements Serializable, Cloneable { +@Builder(setterPrefix = "with") +@NoArgsConstructor +@AllArgsConstructor +public class ApplicationLoadBalancerRequestEvent implements Serializable { - @NoArgsConstructor @Data - public static class Elb implements Serializable, Cloneable { + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor + public static class Elb implements Serializable { private String targetGroupArn; } - @NoArgsConstructor @Data - public static class RequestContext implements Serializable, Cloneable { + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor + public static class RequestContext implements Serializable { private Elb elb; @@ -43,6 +66,7 @@ public static class RequestContext implements Serializable, Cloneable { private Map headers; private Map> multiValueHeaders; private String body; + @JsonProperty("isBase64Encoded") private boolean isBase64Encoded; -} +} \ No newline at end of file diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ApplicationLoadBalancerResponseEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ApplicationLoadBalancerResponseEvent.java index 135de143..5033fc75 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ApplicationLoadBalancerResponseEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ApplicationLoadBalancerResponseEvent.java @@ -1,8 +1,25 @@ +/* + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with + * the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + package com.amazonaws.services.lambda.runtime.events; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import com.fasterxml.jackson.annotation.JsonProperty; + import java.io.Serializable; import java.util.List; import java.util.Map; @@ -15,15 +32,18 @@ * @author msailes */ -@NoArgsConstructor @Data -public class ApplicationLoadBalancerResponseEvent implements Serializable, Cloneable { +@Builder(setterPrefix = "with") +@NoArgsConstructor +@AllArgsConstructor +public class ApplicationLoadBalancerResponseEvent implements Serializable { private int statusCode; private String statusDescription; + @JsonProperty("isBase64Encoded") private boolean isBase64Encoded; private Map headers; private Map> multiValueHeaders; private String body; -} +} \ No newline at end of file diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CloudFormationCustomResourceEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CloudFormationCustomResourceEvent.java index 37c00a90..c179b3c7 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CloudFormationCustomResourceEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CloudFormationCustomResourceEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -10,6 +10,7 @@ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ + package com.amazonaws.services.lambda.runtime.events; import lombok.AllArgsConstructor; @@ -17,15 +18,14 @@ import lombok.Data; import lombok.NoArgsConstructor; +import com.fasterxml.jackson.annotation.JsonProperty; + import java.io.Serializable; import java.util.Map; /** * Class to represent the custom resource request event from CloudFormation. * - * CloudFormation invokes your Lambda function asynchronously with this event and includes a callback URL. The function - * is responsible for returning a response to the callback URL that indicates success or failure. - * * @see Using AWS Lambda with AWS CloudFormation * * @author msailes @@ -37,14 +37,33 @@ @AllArgsConstructor public class CloudFormationCustomResourceEvent implements Serializable, Cloneable { + @JsonProperty("RequestType") private String requestType; + + @JsonProperty("ServiceToken") private String serviceToken; + + @JsonProperty("ResponseURL") private String responseUrl; + + @JsonProperty("StackId") private String stackId; + + @JsonProperty("RequestId") private String requestId; + + @JsonProperty("LogicalResourceId") private String logicalResourceId; + + @JsonProperty("PhysicalResourceId") private String physicalResourceId; + + @JsonProperty("ResourceType") private String resourceType; + + @JsonProperty("ResourceProperties") private Map resourceProperties; + + @JsonProperty("OldResourceProperties") private Map oldResourceProperties; -} +} \ No newline at end of file diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CloudFrontEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CloudFrontEvent.java index 59257ce7..8fbd20c9 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CloudFrontEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CloudFrontEvent.java @@ -1,5 +1,25 @@ +/* + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with + * the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + package com.amazonaws.services.lambda.runtime.events; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import com.fasterxml.jackson.annotation.JsonProperty; + import java.io.Serializable; import java.util.List; import java.util.Map; @@ -7,15 +27,26 @@ /** * Class that represents a CloudFront event */ + +@Data +@Builder(setterPrefix = "with") +@NoArgsConstructor +@AllArgsConstructor public class CloudFrontEvent implements Serializable, Cloneable { private static final long serialVersionUID = -7169297388214516660L; + @JsonProperty("Records") private List records; /** * class that represents a header */ + + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor public static class Header implements Serializable, Cloneable { private static final long serialVersionUID = 7041042740552686996L; @@ -24,107 +55,6 @@ public static class Header implements Serializable, Cloneable { private String value; - /** - * default constructor - */ - public Header() {} - - /** - * @return key value of header - */ - public String getKey() { - return this.key; - } - - /** - * @param key value of header - */ - public void setKey(String key) { - this.key = key; - } - - /** - * @param key value of header - * @return Header object - */ - public Header withKey(String key) { - setKey(key); - return this; - } - - /** - * @return value of header value - */ - public String getValue() { - return this.value; - } - - /** - * @param value of header value - */ - public void setValue(String value) { - this.value = value; - } - - /** - * @param value of header value - * @return Header object - */ - public Header withValue(String value) { - setValue(value); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getKey() != null) - sb.append("key: ").append(getKey()).append(","); - if (getValue() != null) - sb.append("value: ").append(getValue()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof Header == false) - return false; - Header other = (Header) obj; - if (other.getKey() == null ^ this.getKey() == null) - return false; - if (other.getKey() != null && other.getKey().equals(this.getKey()) == false) - return false; - if (other.getValue() == null ^ this.getValue() == null) - return false; - if (other.getValue() != null && other.getValue().equals(this.getValue()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getKey() == null) ? 0 : getKey().hashCode()); - hashCode = prime * hashCode + ((getValue() == null) ? 0 : getValue().hashCode()); - return hashCode; - } - @Override public Header clone() { try { @@ -139,84 +69,17 @@ public Header clone() { /** * Class that represents the configuration of a CloudFront message */ + + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor public static class Config implements Serializable, Cloneable { private static final long serialVersionUID = -286083903805870299L; private String distributionId; - /** - * default constructor - */ - public Config() {} - - /** - * @return distribution id of cloud front entity - */ - public String getDistributionId() { - return this.distributionId; - } - - /** - * @param distributionId distribution id of cloud front entity - */ - public void setDistributionId(String distributionId) { - this.distributionId = distributionId; - } - - /** - * @param distributionId distribution id of cloud front entity - * @return Config - */ - public Config withDistributionId(String distributionId) { - setDistributionId(distributionId); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getDistributionId() != null) - sb.append("distributionId: ").append(getDistributionId()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof Config == false) - return false; - Config other = (Config) obj; - if (other.getDistributionId() == null ^ this.getDistributionId() == null) - return false; - if (other.getDistributionId() != null && other.getDistributionId().equals(this.getDistributionId()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getDistributionId() == null) ? 0 : getDistributionId().hashCode()); - - return hashCode; - } - @Override public Config clone() { try { @@ -231,6 +94,11 @@ public Config clone() { /** * class that represents a CLoudFront request */ + + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor public static class Request implements Serializable, Cloneable { private static final long serialVersionUID = 3245036101075464149L; @@ -245,197 +113,6 @@ public static class Request implements Serializable, Cloneable { private Map> headers; - /** - * default constructor - */ - public Request() {} - - /** - * @return uri of cloud front endpoint - */ - public String getUri() { - return this.uri; - } - - /** - * @param uri uri of cloud front endpoint - */ - public void setUri(String uri) { - this.uri = uri; - } - - /** - * @param uri uri of cloud front endpoint - * @return Request object - */ - public Request withUri(String uri) { - setUri(uri); - return this; - } - - /** - * @return method used by cloud front entity - */ - public String getMethod() { - return this.method; - } - - /** - * @param method method used by cloud front entity - */ - public void setMethod(String method) { - this.method = method; - } - - /** - * @param method method used by cloud front entity - * @return Request object - */ - public Request withMethod(String method) { - setMethod(method); - return this; - } - - /** - * @return httpVersion http version used by cloud front - */ - public String getHttpVersion() { - return this.httpVersion; - } - - /** - * @param httpVersion http version used by cloud front - */ - public void setHttpVersion(String httpVersion) { - this.httpVersion = httpVersion; - } - - /** - * @param httpVersion http version used by cloud front - * @return Request - */ - public Request withHttpVersion(String httpVersion) { - setHttpVersion((httpVersion)); - return this; - } - - /** - * @return client ip address - */ - public String getClientIp() { - return this.clientIp; - } - - /** - * @param clientIp client ip address - */ - public void setClientIp(String clientIp) { - this.clientIp = clientIp; - } - - /** - * @param clientIp client ip address - * @return Request object - */ - public Request withClientIp(String clientIp) { - setClientIp(clientIp); - return this; - } - - /** - * @return headers used in the cloud front request - */ - public Map> getHeaders() { - return this.headers; - } - - /** - * @param headers headers used in the cloud front request - */ - public void setHeaders(Map> headers) { - this.headers = headers; - } - - /** - * @param headers used in the cloud front request - * @return Response object - */ - public Request withHeaders(Map> headers) { - setHeaders(headers); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getUri() != null) - sb.append("uri: ").append(getUri()).append(","); - if (getMethod() != null) - sb.append("method: ").append(getMethod()).append(","); - if (getHttpVersion() != null) - sb.append("httpVersion: ").append(getHttpVersion()).append(","); - if (getClientIp() != null) - sb.append("clientIp: ").append(getClientIp()).append(","); - if (getHeaders() != null) - sb.append("headers: ").append(getHeaders().toString()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof Request == false) - return false; - Request other = (Request) obj; - if (other.getUri() == null ^ this.getUri() == null) - return false; - if (other.getUri() != null && other.getUri().equals(this.getUri()) == false) - return false; - if (other.getMethod() == null ^ this.getMethod() == null) - return false; - if (other.getMethod() != null && other.getMethod().equals(this.getMethod()) == false) - return false; - if (other.getHttpVersion() == null ^ this.getHttpVersion() == null) - return false; - if (other.getHttpVersion() != null && other.getHttpVersion().equals(this.getHttpVersion()) == false) - return false; - if (other.getClientIp() == null ^ this.getClientIp() == null) - return false; - if (other.getClientIp() != null && other.getClientIp().equals(this.getClientIp()) == false) - return false; - if (other.getHeaders() == null ^ this.getHeaders() == null) - return false; - if (other.getHeaders() != null && other.getHeaders().equals(this.getHeaders()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getUri() == null) ? 0 : getUri().hashCode()); - hashCode = prime * hashCode + ((getMethod() == null) ? 0 : getMethod().hashCode()); - hashCode = prime * hashCode + ((getHttpVersion() == null) ? 0 : getHttpVersion().hashCode()); - hashCode = prime * hashCode + ((getClientIp() == null) ? 0 : getClientIp().hashCode()); - hashCode = prime * hashCode + ((getHeaders() == null) ? 0 : getHeaders().hashCode()); - return hashCode; - } - @Override public Request clone() { try { @@ -449,6 +126,11 @@ public Request clone() { /** * class that represents a Response object */ + + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor public static class Response implements Serializable, Cloneable { private static final long serialVersionUID = -3711565862079053710L; @@ -461,167 +143,6 @@ public static class Response implements Serializable, Cloneable { private Map> headers; - /** - * default constructor - */ - public Response() {} - - /** - * @return status code returned by cloud front - */ - public String getStatus() { - return this.status; - } - - /** - * @param status status code returned by cloud front - */ - public void setStatus(String status) { - this.status = status; - } - - /** - * @param status status code returned by cloud front - * @return Response - */ - public Response withStatus(String status) { - setStatus(status); - return this; - } - - /** - * @return status description returned by cloud front - */ - public String getStatusDescription() { - return this.statusDescription; - } - - /** - * @param statusDescription status description returned by cloud front - */ - public void setStatusDescription(String statusDescription) { - this.statusDescription = statusDescription; - } - - /** - * @param statusDescription status description returned by cloud front - * @return Response - */ - public Response withStatusDescription(String statusDescription) { - setStatusDescription(statusDescription); - return this; - } - - /** - * @return http version used by cloud front - */ - public String getHttpVersion() { - return this.httpVersion; - } - - /** - * @param httpVersion http version used by cloud front - */ - public void setHttpVersion(String httpVersion) { - this.httpVersion = httpVersion; - } - - /** - * @param httpVersion http version used by cloud front - * @return Response object - */ - public Response withHttpVersion(String httpVersion) { - setHttpVersion(httpVersion); - return this; - } - - /** - * @return headers included with the Cloud front response - */ - public Map> getHeaders() { - return this.headers; - } - - /** - * @param headers headers included with the Cloud front response - */ - public void setHeaders(Map> headers) { - this.headers = headers; - } - - /** - * @param headers headers included with the Cloud front response - * @return Response object - */ - public Response withHeaders(Map> headers) { - setHeaders(headers); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getStatus() != null) - sb.append("status: ").append(getStatus()).append(","); - if (getStatusDescription() != null) - sb.append("statusDescription: ").append(getStatusDescription()).append(","); - if (getHttpVersion() != null) - sb.append("httpVersion: ").append(getHttpVersion()).append(","); - if (getHeaders() != null) - sb.append("headers: ").append(getHeaders().toString()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof Response == false) - return false; - Response other = (Response) obj; - if (other.getStatus() == null ^ this.getStatus() == null) - return false; - if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false) - return false; - if (other.getStatusDescription() == null ^ this.getStatusDescription() == null) - return false; - if (other.getStatusDescription() != null && other.getStatusDescription().equals(this.getStatusDescription()) == false) - return false; - if (other.getHttpVersion() == null ^ this.getHttpVersion() == null) - return false; - if (other.getHttpVersion() != null && other.getHttpVersion().equals(this.getHttpVersion()) == false) - return false; - if (other.getHeaders() == null ^ this.getHeaders() == null) - return false; - if (other.getHeaders() != null && other.getHeaders().equals(this.getHeaders()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode()); - hashCode = prime * hashCode + ((getStatusDescription() == null) ? 0 : getStatusDescription().hashCode()); - hashCode = prime * hashCode + ((getHttpVersion() == null) ? 0 : getHttpVersion().hashCode()); - hashCode = prime * hashCode + ((getHeaders() == null) ? 0 : getHeaders().hashCode()); - return hashCode; - } - @Override public Response clone() { try { @@ -636,6 +157,11 @@ public Response clone() { /** * class that represents the CloudFront body within a record */ + + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor public static class CF implements Serializable, Cloneable { private static final long serialVersionUID = -5940167419180448832L; @@ -646,137 +172,6 @@ public static class CF implements Serializable, Cloneable { private Response response; - /** - * default constructor - */ - public CF() {} - - /** - * @return configuration object used by cloud front - */ - public Config getConfig() { - return this.config; - } - - /** - * @param config configuration object used by cloud front - */ - public void setConfig(Config config) { - this.config = config; - } - - /** - * @param config configuration object used by cloud front - * @return CF object - */ - public CF withConfig(Config config) { - setConfig(config); - return this; - } - - /** - * @return Request object - */ - public Request getRequest() { - return this.request; - } - - /** - * @param request Request object used by cloud front - */ - public void setRequest(Request request) { - this.request = request; - } - - /** - * @param request Request object used by cloud front - * @return CF - */ - public CF withRequest(Request request) { - setRequest(request); - return this; - } - - /** - * @return Response object used by cloud front - */ - public Response getResponse() { - return this.response; - } - - /** - * @param response Response object used by cloud front - */ - public void setResponse(Response response) { - this.response = response; - } - - /** - * @param response Response object used by cloud front - * @return CF - */ - public CF withResponse(Response response) { - setResponse(response); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getConfig() != null) - sb.append("config: ").append(getConfig().toString()).append(","); - if (getRequest() != null) - sb.append("request: ").append(getRequest().toString()).append(","); - if (getResponse() != null) - sb.append("response: ").append(getResponse().toString()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof CF == false) - return false; - CF other = (CF) obj; - if (other.getConfig() == null ^ this.getConfig() == null) - return false; - if (other.getConfig() != null && other.getConfig().equals(this.getConfig()) == false) - return false; - if (other.getRequest() == null ^ this.getRequest() == null) - return false; - if (other.getRequest() != null && other.getRequest().equals(this.getRequest()) == false) - return false; - if (other.getResponse() == null ^ this.getResponse() == null) - return false; - if (other.getResponse() != null && other.getResponse().equals(this.getResponse()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getConfig() == null) ? 0 : getConfig().hashCode()); - hashCode = prime * hashCode + ((getRequest() == null) ? 0 : getRequest().hashCode()); - hashCode = prime * hashCode + ((getResponse() == null) ? 0 : getResponse().hashCode()); - return hashCode; - } - @Override public CF clone() { try { @@ -791,83 +186,17 @@ public CF clone() { /** * Class that represents a record in a CLoudFront event */ + + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor public static class Record implements Serializable, Cloneable { private static final long serialVersionUID = -6114551370798889850L; private CF cf; - /** - * default constructor - */ - public Record() {} - - /** - * @return CF object that contains message from cloud front - */ - public CF getCf() { - return this.cf; - } - - /** - * @param cf CF object that contains message from cloud front - */ - public void setCf(CF cf) { - this.cf = cf; - } - - /** - * @param cf CF object that contains message from cloud front - * @return Record object - */ - public Record withCf(CF cf) { - setCf(cf); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getCf() != null) - sb.append("cf: ").append(getCf().toString()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof Record == false) - return false; - Record other = (Record) obj; - if (other.getCf() == null ^ this.getCf() == null) - return false; - if (other.getCf() != null && other.getCf().equals(this.getCf()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getCf() == null) ? 0 : getCf().hashCode()); - return hashCode; - } - @Override public Record clone() { try { @@ -879,77 +208,6 @@ public Record clone() { } - /** - * default constructor - */ - public CloudFrontEvent() {} - - /** - * @return list of records in cloud front event - */ - public List getRecords() { - return this.records; - } - - /** - * @param records list of records in cloud front event - */ - public void setRecords(List records) { - this.records = records; - } - - /** - * @param records list of records in cloud front event - * @return CloudFrontEvent object - */ - public CloudFrontEvent withRecords(List records) { - setRecords(records); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getRecords() != null) - sb.append("records: ").append(getRecords().toString()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof CloudFrontEvent == false) - return false; - CloudFrontEvent other = (CloudFrontEvent) obj; - if (other.getRecords() == null ^ this.getRecords() == null) - return false; - if (other.getRecords() != null && other.getRecords().equals(this.getRecords()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getRecords() == null) ? 0 : getRecords().hashCode()); - return hashCode; - } - @Override public CloudFrontEvent clone() { try { diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CloudWatchLogsEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CloudWatchLogsEvent.java index 1eea0b8e..2c8fca45 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CloudWatchLogsEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CloudWatchLogsEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -13,97 +13,42 @@ package com.amazonaws.services.lambda.runtime.events; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import com.fasterxml.jackson.annotation.JsonProperty; + import java.io.Serializable; /** * Class representing CloudWatchLogs event (callback when cloud watch logs something) */ +@Data +@Builder(setterPrefix = "with") +@NoArgsConstructor +@AllArgsConstructor public class CloudWatchLogsEvent implements Serializable, Cloneable { private static final long serialVersionUID = -1617470828168156271L; + @JsonProperty("awslogs") private AWSLogs awsLogs; /** * Represents AWSLogs object in CloudWatch Evenet */ + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor public static class AWSLogs implements Serializable, Cloneable { private static final long serialVersionUID = -7793438350437169987L; private String data; - /** - * default constructor - */ - public AWSLogs() {} - - /** - * @return String with data - */ - public String getData() { - return this.data; - } - - /** - * @param data String with log data - */ - public void setData(String data) { - this.data = data; - } - - /** - * @param data String with log data - * @return - */ - public AWSLogs withData(String data) { - setData(data); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getData() != null) - sb.append("data: ").append(getData()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof AWSLogs == false) - return false; - AWSLogs other = (AWSLogs) obj; - if (other.getData() == null ^ this.getData() == null) - return false; - if (other.getData() != null && other.getData().equals(this.getData()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getData() == null) ? 0 : getData().hashCode()); - return hashCode; - } - @Override public AWSLogs clone() { try { @@ -115,77 +60,6 @@ public AWSLogs clone() { } - /** - * default constructor - */ - public CloudWatchLogsEvent() {} - - /** - * @return AWSLogs object - */ - public AWSLogs getAwsLogs() { - return this.awsLogs; - } - - /** - * @param awsLogs AWSLogs object - */ - public void setAwsLogs(AWSLogs awsLogs) { - this.awsLogs = awsLogs; - } - - /** - * @param awsLogs AWSLogs object - * @return - */ - public CloudWatchLogsEvent withAwsLogs(AWSLogs awsLogs) { - setAwsLogs(awsLogs); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getAwsLogs() != null) - sb.append("awslogs: ").append(getAwsLogs().toString()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof CloudWatchLogsEvent == false) - return false; - CloudWatchLogsEvent other = (CloudWatchLogsEvent) obj; - if (other.getAwsLogs() == null ^ this.getAwsLogs() == null) - return false; - if (other.getAwsLogs() != null && other.getAwsLogs().equals(this.getAwsLogs()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getAwsLogs() == null) ? 0 : getAwsLogs().hashCode()); - return hashCode; - } - @Override public CloudWatchLogsEvent clone() { try { diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CodeCommitEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CodeCommitEvent.java index d76cba29..8508b5b7 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CodeCommitEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CodeCommitEvent.java @@ -1,22 +1,54 @@ +/* + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with + * the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + package com.amazonaws.services.lambda.runtime.events; -import org.joda.time.DateTime; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import com.fasterxml.jackson.annotation.JsonFormat; + +import com.fasterxml.jackson.annotation.JsonProperty; import java.io.Serializable; +import java.time.Instant; import java.util.List; /** * References a CodeCommit event */ + +@Data +@Builder(setterPrefix = "with") +@NoArgsConstructor +@AllArgsConstructor public class CodeCommitEvent implements Serializable, Cloneable { private static final long serialVersionUID = 2404735479795009282L; + @JsonProperty("Records") private List records; /** * represents a Reference object in a CodeCommit object */ + + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor public static class Reference implements Serializable, Cloneable { private static final long serialVersionUID = 9166524005926768827L; @@ -27,137 +59,6 @@ public static class Reference implements Serializable, Cloneable { private Boolean created; - /** - * default constructor - */ - public Reference() {} - - /** - * @return commit id - */ - public String getCommit() { - return this.commit; - } - - /** - * @param commit set commit id - */ - public void setCommit(String commit) { - this.commit = commit; - } - - /** - * @param commit commit id - * @return Reference - */ - public Reference withCommit(String commit) { - setCommit(commit); - return this; - } - - /** - * @return reference id - */ - public String getRef() { - return this.ref; - } - - /** - * @param ref reference id - */ - public void setRef(String ref) { - this.ref = ref; - } - - /** - * @param ref reference id - * @return Reference object - */ - public Reference withRef(String ref) { - setRef(ref); - return this; - } - - /** - * @return whether reference was created - */ - public Boolean getCreated() { - return this.created; - } - - /** - * @param created whether reference was created - */ - public void setCreated(Boolean created) { - this.created = created; - } - - /** - * @param created whether reference was created - * @return Reference object - */ - public Reference withCreated(Boolean created) { - setCreated(created); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getCommit() != null) - sb.append("commit: ").append(getCommit()).append(","); - if (getRef() != null) - sb.append("ref: ").append(getRef()).append(","); - if (getCreated() != null) - sb.append("created: ").append(getCreated().toString()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof Reference == false) - return false; - Reference other = (Reference) obj; - if (other.getCommit() == null ^ this.getCommit() == null) - return false; - if (other.getCommit() != null && other.getCommit().equals(this.getCommit()) == false) - return false; - if (other.getRef() == null ^ this.getRef() == null) - return false; - if (other.getRef() != null && other.getRef().equals(this.getRef()) == false) - return false; - if (other.getCreated() == null ^ this.getCreated() == null) - return false; - if (other.getCreated() != null && other.getCreated().equals(this.getCreated()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getCommit() == null) ? 0 : getCommit().hashCode()); - hashCode = prime * hashCode + ((getRef() == null) ? 0 : getRef().hashCode()); - hashCode = prime * hashCode + ((getCreated() == null) ? 0 : getCreated().hashCode()); - return hashCode; - } - @Override public Reference clone() { try { @@ -171,84 +72,17 @@ public Reference clone() { /** * Represents a CodeCommit object in a record */ + + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor public static class CodeCommit implements Serializable, Cloneable { private static final long serialVersionUID = 2594306162311794147L; private List references; - /** - * default constructor - */ - public CodeCommit() {} - - /** - * @return list of Reference objects in the CodeCommit event - */ - public List getReferences() { - return this.references; - } - - /** - * @param references list of Reference objects in the CodeCommit event - */ - public void setReferences(List references) { - this.references = references; - } - - /** - * @param references list of Reference objects in the CodeCommit event - * @return CodeCommit - */ - public CodeCommit withReferences(List references) { - setReferences(references); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getReferences() != null) - sb.append("references: ").append(getReferences().toString()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof CodeCommit == false) - return false; - CodeCommit other = (CodeCommit) obj; - if (other.getReferences() == null ^ this.getReferences() == null) - return false; - if (other.getReferences() != null && other.getReferences().equals(this.getReferences()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getReferences() == null) ? 0 : getReferences().hashCode()); - - return hashCode; - } - @Override public CodeCommit clone() { try { @@ -262,6 +96,11 @@ public CodeCommit clone() { /** * represents a CodeCommit record */ + + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor public static class Record implements Serializable, Cloneable { private static final long serialVersionUID = 1116409777237432728L; @@ -270,20 +109,24 @@ public static class Record implements Serializable, Cloneable { private String eventVersion; - private DateTime eventTime; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSX", timezone = "UTC") + private Instant eventTime; private String eventTriggerName; private Integer eventPartNumber; + @JsonProperty("codecommit") private CodeCommit codeCommit; private String eventName; private String eventTriggerConfigId; + @JsonProperty("eventSourceARN") private String eventSourceArn; + @JsonProperty("userIdentityARN") private String userIdentityArn; private String eventSource; @@ -294,465 +137,6 @@ public static class Record implements Serializable, Cloneable { private Integer eventTotalParts; - /** - * default constructor - */ - public Record() {} - - /** - * @return event id - */ - public String getEventId() { - return this.eventId; - } - - /** - * @param eventId event id - */ - public void setEventId(String eventId) { - this.eventId = eventId; - } - - /** - * @param eventId event id - * @return Record - */ - public Record withEventId(String eventId) { - setEventId(eventId); - return this; - } - - /** - * @return event version - */ - public String getEventVersion() { - return this.eventVersion; - } - - /** - * @param eventVersion event version - */ - public void setEventVersion(String eventVersion) { - this.eventVersion = eventVersion; - } - - /** - * @param eventVersion event version - * @return Record - */ - public Record withEventVersion(String eventVersion) { - setEventVersion(eventVersion); - return this; - } - - /** - * @return event timestamp - */ - public DateTime getEventTime() { - return this.eventTime; - } - - /** - * @param eventTime event timestamp - */ - public void setEventTime(DateTime eventTime) { - this.eventTime = eventTime; - } - - /** - * @param eventTime event timestamp - * @return Record - */ - public Record withEventTime(DateTime eventTime) { - setEventTime(eventTime); - return this; - } - - /** - * @return event trigger name - */ - public String getEventTriggerName() { - return this.eventTriggerName; - } - - /** - * @param eventTriggerName event trigger name - */ - public void setEventTriggerName(String eventTriggerName) { - this.eventTriggerName = eventTriggerName; - } - - /** - * @param eventTriggerName - * @return Record - */ - public Record withEventTriggerName(String eventTriggerName) { - setEventTriggerName(eventTriggerName); - return this; - } - - /** - * @return event part number - */ - public Integer getEventPartNumber() { - return this.eventPartNumber; - } - - /** - * @param eventPartNumber event part number - */ - public void setEventPartNumber(Integer eventPartNumber) { - this.eventPartNumber = eventPartNumber; - } - - /** - * @param eventPartNumber event part number - * @return Record - */ - public Record withEventPartNumber(Integer eventPartNumber) { - setEventPartNumber(eventPartNumber); - return this; - } - - /** - * @return code commit - */ - public CodeCommit getCodeCommit() { - return this.codeCommit; - } - - /** - * @param codeCommit code commit - */ - public void setCodeCommit(CodeCommit codeCommit) { - this.codeCommit = codeCommit; - } - - /** - * @param codeCommit code commit - * @return Record - */ - public Record withCodeCommit(CodeCommit codeCommit) { - setCodeCommit(codeCommit); - return this; - } - - /** - * @return event name - */ - public String getEventName() { - return this.eventName; - } - - /** - * @param eventName event name - */ - public void setEventName(String eventName) { - this.eventName = eventName; - } - - /** - * @param eventName event name - * @return Record - */ - public Record withEventName(String eventName) { - setEventName(eventName); - return this; - } - - /** - * @return event trigger config id - */ - public String getEventTriggerConfigId() { - return this.eventTriggerConfigId; - } - - /** - * @param eventTriggerConfigId event trigger config id - */ - public void setEventTriggerConfigId(String eventTriggerConfigId) { - this.eventTriggerConfigId = eventTriggerConfigId; - } - - /** - * @param eventTriggerConfigId event trigger config id - * @return Record - */ - public Record withEventTriggerConfigId(String eventTriggerConfigId) { - setEventTriggerConfigId(eventTriggerConfigId); - return this; - } - - /** - * @return event source arn - */ - public String getEventSourceArn() { - return this.eventSourceArn; - } - - /** - * @param eventSourceArn event source arn - */ - public void setEventSourceArn(String eventSourceArn) { - this.eventSourceArn = eventSourceArn; - } - - /** - * @param eventSourceArn event source arn - * @return Record - */ - public Record withEventSourceArn(String eventSourceArn) { - setEventSourceArn(eventSourceArn); - return this; - } - - /** - * @return user identity arn - */ - public String getUserIdentityArn() { - return this.userIdentityArn; - } - - /** - * @param userIdentityArn user identity arn - */ - public void setUserIdentityArn(String userIdentityArn) { - this.userIdentityArn = userIdentityArn; - } - - /** - * @param userIdentityArn user identity arn - * @return Record - */ - public Record withUserIdentityArn(String userIdentityArn) { - setUserIdentityArn(userIdentityArn); - return this; - } - - /** - * @return event source - */ - public String getEventSource() { - return this.eventSource; - } - - /** - * @param eventSource event source - */ - public void setEventSource(String eventSource) { - this.eventSource = eventSource; - } - - /** - * @param eventSource event source - * @return Record - */ - public Record withEventSource(String eventSource) { - setEventSource(eventSource); - return this; - } - - /** - * @return aws region - */ - public String getAwsRegion() { - return this.awsRegion; - } - - /** - * @param awsRegion aws region - */ - public void setAwsRegion(String awsRegion) { - this.awsRegion = awsRegion; - } - - /** - * @param awsRegion aws region - * @return Record - */ - public Record withAwsRegion(String awsRegion) { - setAwsRegion(awsRegion); - return this; - } - - /** - * @return event total parts - */ - public Integer getEventTotalParts() { - return this.eventTotalParts; - } - - /** - * @param eventTotalParts event total parts - */ - public void setEventTotalParts(Integer eventTotalParts) { - this.eventTotalParts = eventTotalParts; - } - - /** - * @param eventTotalParts event total parts - * @return Record - */ - public Record withEventTotalParts(Integer eventTotalParts) { - setEventTotalParts(eventTotalParts); - return this; - } - - /** - * - * @return custom data - */ - public String getCustomData(){ return this.customData;} - - /** - * - * @param customData event custom data - */ - public void setCustomData(String customData) { this.customData = customData;} - - /** - * @param customData event - * @return Record - */ - public Record withCustomData(String customData) { - setCustomData(customData); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getEventId() != null) - sb.append("eventId: ").append(getEventId()).append(","); - if (getEventVersion() != null) - sb.append("eventVersion: ").append(getEventVersion()).append(","); - if (getEventTime() != null) - sb.append("eventTime: ").append(getEventTime().toString()).append(","); - if (getEventTriggerName() != null) - sb.append("eventTriggerName: ").append(getEventTriggerName()).append(","); - if (getEventPartNumber() != null) - sb.append("eventPartNumber: ").append(getEventPartNumber().toString()).append(","); - if (getCodeCommit() != null) - sb.append("codeCommit: ").append(getCodeCommit().toString()).append(","); - if (getEventName() != null) - sb.append("eventName: ").append(getEventName()).append(","); - if (getEventTriggerConfigId() != null) - sb.append("eventTriggerConfigId: ").append(getEventTriggerConfigId()).append(","); - if (getEventSourceArn() != null) - sb.append("eventSourceArn: ").append(getEventSourceArn()).append(","); - if (getUserIdentityArn() != null) - sb.append("userIdentityArn: ").append(getUserIdentityArn()).append(","); - if (getEventSource() != null) - sb.append("eventSource: ").append(getEventSource()).append(","); - if (getAwsRegion() != null) - sb.append("awsRegion: ").append(getAwsRegion()).append(","); - if (getCustomData() != null) - sb.append("customData: ").append(getCustomData()).append(","); - if (getEventTotalParts() != null) - sb.append("eventTotalParts: ").append(getEventTotalParts()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof Record == false) - return false; - Record other = (Record) obj; - if (other.getEventId() == null ^ this.getEventId() == null) - return false; - if (other.getEventId() != null && other.getEventId().equals(this.getEventId()) == false) - return false; - if (other.getEventVersion() == null ^ this.getEventVersion() == null) - return false; - if (other.getEventVersion() != null && other.getEventVersion().equals(this.getEventVersion()) == false) - return false; - if (other.getEventTime() == null ^ this.getEventTime() == null) - return false; - if (other.getEventTime() != null && other.getEventTime().equals(this.getEventTime()) == false) - return false; - if (other.getEventTriggerName() == null ^ this.getEventTriggerName() == null) - return false; - if (other.getEventTriggerName() != null && other.getEventTriggerName().equals(this.getEventTriggerName()) == false) - return false; - if (other.getEventPartNumber() == null ^ this.getEventPartNumber() == null) - return false; - if (other.getEventPartNumber() != null && other.getEventPartNumber().equals(this.getEventPartNumber()) == false) - return false; - if (other.getCodeCommit() == null ^ this.getCodeCommit() == null) - return false; - if (other.getCodeCommit() != null && other.getCodeCommit().equals(this.getCodeCommit()) == false) - return false; - if (other.getEventName() == null ^ this.getEventName() == null) - return false; - if (other.getEventName() != null && other.getEventName().equals(this.getEventName()) == false) - return false; - if (other.getEventTriggerConfigId() == null ^ this.getEventTriggerConfigId() == null) - return false; - if (other.getEventTriggerConfigId() != null && other.getEventTriggerConfigId().equals(this.getEventTriggerConfigId()) == false) - return false; - if (other.getEventSourceArn() == null ^ this.getEventSourceArn() == null) - return false; - if (other.getEventSourceArn() != null && other.getEventSourceArn().equals(this.getEventSourceArn()) == false) - return false; - if (other.getUserIdentityArn() == null ^ this.getUserIdentityArn() == null) - return false; - if (other.getUserIdentityArn() != null && other.getUserIdentityArn().equals(this.getUserIdentityArn()) == false) - return false; - if (other.getEventSource() == null ^ this.getEventSource() == null) - return false; - if (other.getEventSource() != null && other.getEventSource().equals(this.getEventSource()) == false) - return false; - if (other.getAwsRegion() == null ^ this.getAwsRegion() == null) - return false; - if (other.getAwsRegion() != null && other.getAwsRegion().equals(this.getAwsRegion()) == false) - return false; - if (other.getEventTotalParts() == null ^ this.getEventTotalParts() == null) - return false; - if (other.getEventTotalParts() != null && other.getEventTotalParts().equals(this.getEventTotalParts()) == false) - return false; - if (other.getCustomData() == null ^ this.getCustomData() == null) - return false; - if (other.getCustomData() != null && other.getCustomData().equals(this.getCustomData()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getEventId() == null) ? 0 : getEventId().hashCode()); - hashCode = prime * hashCode + ((getEventVersion() == null) ? 0 : getEventVersion().hashCode()); - hashCode = prime * hashCode + ((getEventTime() == null) ? 0 : getEventTime().hashCode()); - hashCode = prime * hashCode + ((getEventTriggerName() == null) ? 0 : getEventTriggerName().hashCode()); - hashCode = prime * hashCode + ((getEventPartNumber() == null) ? 0 : getEventPartNumber().hashCode()); - hashCode = prime * hashCode + ((getCodeCommit() == null) ? 0 : getCodeCommit().hashCode()); - hashCode = prime * hashCode + ((getEventName() == null) ? 0 : getEventName().hashCode()); - hashCode = prime * hashCode + ((getEventTriggerConfigId() == null) ? 0 : getEventTriggerConfigId().hashCode()); - hashCode = prime * hashCode + ((getEventSourceArn() == null) ? 0 : getEventSourceArn().hashCode()); - hashCode = prime * hashCode + ((getUserIdentityArn() == null) ? 0 : getUserIdentityArn().hashCode()); - hashCode = prime * hashCode + ((getEventSource() == null) ? 0 : getEventSource().hashCode()); - hashCode = prime * hashCode + ((getAwsRegion() == null) ? 0 : getAwsRegion().hashCode()); - hashCode = prime * hashCode + ((getEventTotalParts() == null) ? 0 : getEventTotalParts().hashCode()); - hashCode = prime * hashCode + ((getCustomData() == null) ? 0 : getCustomData().hashCode()); - return hashCode; - } - @Override public Record clone() { try { @@ -764,77 +148,6 @@ public Record clone() { } - /** - * default constructor - */ - public CodeCommitEvent() {} - - /** - * @return records - */ - public List getRecords() { - return this.records; - } - - /** - * @param records records - */ - public void setRecords(List records) { - this.records = records; - } - - /** - * @param records records - * @return CodeCommitEvent - */ - public CodeCommitEvent withRecords(List records) { - setRecords(records); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getRecords() != null) - sb.append("records: ").append(getRecords().toString()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof CodeCommitEvent == false) - return false; - CodeCommitEvent other = (CodeCommitEvent) obj; - if (other.getRecords() == null ^ this.getRecords() == null) - return false; - if (other.getRecords() != null && other.getRecords().equals(this.getRecords()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getRecords() == null) ? 0 : getRecords().hashCode()); - return hashCode; - } - @Override public CodeCommitEvent clone() { try { diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoEvent.java deleted file mode 100644 index 452d3d6f..00000000 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoEvent.java +++ /dev/null @@ -1,497 +0,0 @@ -/* - * Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with - * the License. A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR - * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions - * and limitations under the License. - */ - -package com.amazonaws.services.lambda.runtime.events; - -import java.io.Serializable; -import java.util.Map; - -/** - * - * Represents an Amazon Cognito event sent to Lambda Functions - * - */ -public class CognitoEvent implements Serializable, Cloneable { - - private static final long serialVersionUID = -3471890133562627751L; - - private String region; - - private Map datasetRecords; - - private String identityPoolId; - - private String identityId; - - private String datasetName; - - private String eventType; - - private Integer version; - - /** - * DatasetRecord contains the information about each record in a data set. - * - */ - public static class DatasetRecord implements Serializable, Cloneable { - - private static final long serialVersionUID = -8853471047466644850L; - - private String oldValue; - - private String newValue; - - private String op; - - /** - * default constructor - * (Not available in v1) - */ - public DatasetRecord() {} - - /** - * Get the record's old value - * @return old value - */ - public String getOldValue() { - return oldValue; - } - - /** - * Sets the record's old value - * @param oldValue A string containing the old value - */ - public void setOldValue(String oldValue) { - this.oldValue = oldValue; - } - - /** - * @param oldValue String with old value - * @return DatasetRecord object - */ - public DatasetRecord withOldValue(String oldValue) { - setOldValue(oldValue); - return this; - } - - /** - * Gets the record's new value - * @return new value - */ - public String getNewValue() { - return newValue; - } - - /** - * Sets the records new value - * @param newValue A string containing the new value - */ - public void setNewValue(String newValue) { - this.newValue = newValue; - } - - /** - * @param newValue new value for record - * @return DatasetRecord object - */ - public DatasetRecord withNewValue(String newValue) { - setNewValue(newValue); - return this; - } - - /** - * Gets the operation associated with the record - *

- *

    - *
  • - * For a new record or any updates to existing record it is set to "replace". - *
  • - *
  • - * For deleting a record it is set to "remove". - *
  • - *
- *

- */ - public String getOp() { - return op; - } - - /** - * Sets the operation associated with the record - *

- *

    - *
  • - * For a new record or any updates to existing record it is set to "replace". - *
  • - *
  • - * For deleting a record it is set to "remove". - *
  • - *
- *

- * @param op A string with a value of "replace" of "remove" - */ - public void setOp(String op) { - this.op = op; - } - - /** - * @param op String operation - * @return DatasetRecord object - */ - public DatasetRecord withOp(String op) { - setOp(op); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getOldValue() != null) - sb.append("oldValue: ").append(getOldValue()).append(","); - if (getNewValue() != null) - sb.append("newValue: ").append(getNewValue()).append(","); - if (getOp() != null) - sb.append("op: ").append(getOp()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof DatasetRecord == false) - return false; - DatasetRecord other = (DatasetRecord) obj; - if (other.getOldValue() == null ^ this.getOldValue() == null) - return false; - if (other.getOldValue() != null && other.getOldValue().equals(this.getOldValue()) == false) - return false; - if (other.getNewValue() == null ^ this.getNewValue() == null) - return false; - if (other.getNewValue() != null && other.getNewValue().equals(this.getNewValue()) == false) - return false; - if (other.getOp() == null ^ this.getOp() == null) - return false; - if (other.getOp() != null && other.getOp().equals(this.getOp()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getOldValue() == null) ? 0 : getOldValue().hashCode()); - hashCode = prime * hashCode + ((getNewValue() == null) ? 0 : getNewValue().hashCode()); - hashCode = prime * hashCode + ((getOp() == null) ? 0 : getOp().hashCode()); - return hashCode; - } - - @Override - public DatasetRecord clone() { - try { - return (DatasetRecord) super.clone(); - } catch (CloneNotSupportedException e) { - throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e); - } - } - } - - /** - * default constructor - * (Not available in v1) - */ - public CognitoEvent() {} - - /** - * Gets the region in which data set resides. - * @return aws region - */ - public String getRegion() { - return region; - } - - /** - * Sets the region in which data set resides. - * @param region A string containing a region name - */ - public void setRegion(String region) { - this.region = region; - } - - /** - * @param region String of region name - * @return CognitoEvent - */ - public CognitoEvent withRegion(String region) { - setRegion(region); - return this; - } - - /** - * Gets the map of data set records for the event - * @return map of dataset records - */ - public Map getDatasetRecords() { - return datasetRecords; - } - - /** - * Sets the map of data set records for the event - * @param datasetRecords A map of string & data set record key/value pairs - */ - public void setDatasetRecords(Map datasetRecords) { - this.datasetRecords = datasetRecords; - } - - /** - * @param datasetRecords a map of string & data set record key/value pairs - * @return CognitoEvent - */ - public CognitoEvent withDatasetRecords(Map datasetRecords) { - setDatasetRecords(datasetRecords); - return this; - } - - /** - * Gets the identity pool ID associated with the data set - * @return identity pool id - */ - public String getIdentityPoolId() { - return identityPoolId; - } - - /** - * Sets the identity pool ID associated with the data set - * @param identityPoolId A string containing the identity pool ID. - */ - public void setIdentityPoolId(String identityPoolId) { - this.identityPoolId = identityPoolId; - } - - /** - * @param identityPoolId a string containing the identity pool ID - * @return CognitoEvent - */ - public CognitoEvent withIdentityPoolId(String identityPoolId) { - setIdentityPoolId(identityPoolId); - return this; - } - - /** - * Gets the identity pool ID associated with the data set - * @return identity id - */ - public String getIdentityId() { - return identityId; - } - - /** - * Sets the identity pool ID associated with the data set - * @param identityId A string containing the identity pool ID - */ - public void setIdentityId(String identityId) { - this.identityId = identityId; - } - - /** - * @param identityId a string containing identity id - * @return CognitoEvent - */ - public CognitoEvent withIdentityId(String identityId) { - setIdentityId(identityId); - return this; - } - - /** - * Gets the data set name of the event - * @return dataset name - */ - public String getDatasetName() { - return datasetName; - } - - /** - * Sets the data set name for the event - * @param datasetName A string containing the data set name - */ - public void setDatasetName(String datasetName) { - this.datasetName = datasetName; - } - - /** - * @param datasetName String with data set name - * @return CognitoEvent - */ - public CognitoEvent withDatasetName(String datasetName) { - setDatasetName(datasetName); - return this; - } - - /** - * Gets the event type - * @return event type - */ - public String getEventType() { - return eventType; - } - - /** - * Sets the event type - * @param eventType A string containing the event type - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - - /** - * @param eventType String with event type - * @return CognitoEvent - */ - public CognitoEvent withEventType(String eventType) { - setEventType(eventType); - return this; - } - - /** - * Gets the event version - * @return version as integer - */ - public Integer getVersion() { - return version; - } - - /** - * Sets the event version - * @param version An integer representing the event version - */ - public void setVersion(Integer version) { - this.version = version; - } - - /** - * @param version Integer with version - * @return CognitoEvent - */ - public CognitoEvent withVersion(Integer version) { - setVersion(version); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getRegion() != null) - sb.append("region: ").append(getRegion()).append(","); - if (getDatasetRecords() != null) - sb.append("datasetRecords: ").append(getDatasetRecords().toString()).append(","); - if (getIdentityPoolId() != null) - sb.append("identityPoolId: ").append(getIdentityPoolId()).append(","); - if (getIdentityId() != null) - sb.append("identityId: ").append(getIdentityId()).append(","); - if (getDatasetName() != null) - sb.append("datasetName: ").append(getDatasetName()).append(","); - if (getEventType() != null) - sb.append("eventType: ").append(getEventType()).append(","); - if (getVersion() != null) - sb.append("version: ").append(getVersion().toString()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof CognitoEvent == false) - return false; - CognitoEvent other = (CognitoEvent) obj; - if (other.getRegion() == null ^ this.getRegion() == null) - return false; - if (other.getRegion() != null && other.getRegion().equals(this.getRegion()) == false) - return false; - if (other.getDatasetRecords() == null ^ this.getDatasetRecords() == null) - return false; - if (other.getDatasetRecords() != null && other.getDatasetRecords().equals(this.getDatasetRecords()) == false) - return false; - if (other.getIdentityPoolId() == null ^ this.getIdentityPoolId() == null) - return false; - if (other.getIdentityPoolId() != null && other.getIdentityPoolId().equals(this.getIdentityPoolId()) == false) - return false; - if (other.getIdentityId() == null ^ this.getIdentityId() == null) - return false; - if (other.getIdentityId() != null && other.getIdentityId().equals(this.getIdentityId()) == false) - return false; - if (other.getDatasetName() == null ^ this.getDatasetName() == null) - return false; - if (other.getDatasetName() != null && other.getDatasetName().equals(this.getDatasetName()) == false) - return false; - if (other.getEventType() == null ^ this.getEventType() == null) - return false; - if (other.getEventType() != null && other.getEventType().equals(this.getEventType()) == false) - return false; - if (other.getVersion() == null ^ this.getVersion() == null) - return false; - if (other.getVersion() != null && other.getVersion().equals(this.getVersion()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - hashCode = prime * hashCode + ((getRegion() == null) ? 0 : getRegion().hashCode()); - hashCode = prime * hashCode + ((getDatasetRecords() == null) ? 0 : getDatasetRecords().hashCode()); - hashCode = prime * hashCode + ((getIdentityPoolId() == null) ? 0 : getIdentityPoolId().hashCode()); - hashCode = prime * hashCode + ((getIdentityId() == null) ? 0 : getIdentityId().hashCode()); - hashCode = prime * hashCode + ((getDatasetName() == null) ? 0 : getDatasetName().hashCode()); - hashCode = prime * hashCode + ((getEventType() == null) ? 0 : getEventType().hashCode()); - hashCode = prime * hashCode + ((getVersion() == null) ? 0 : getVersion().hashCode()); - return hashCode; - } - - @Override - public CognitoEvent clone() { - try { - return (CognitoEvent) super.clone(); - } catch (CloneNotSupportedException e) { - throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e); - } - } - -} diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ConfigEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ConfigEvent.java index b2bb9b00..3317efda 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ConfigEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ConfigEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -13,400 +13,84 @@ package com.amazonaws.services.lambda.runtime.events; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + import java.io.Serializable; /** * Represents an event for an AWS Config rule's function. */ + +@Data +@Builder(setterPrefix = "with") +@NoArgsConstructor +@AllArgsConstructor public class ConfigEvent implements Serializable, Cloneable { private static final long serialVersionUID = -3484211708255634243L; - private String version; - - private String invokingEvent; - - private String ruleParameters; - - private String resultToken; - - private String configRuleArn; - - private String configRuleId; - - private String configRuleName; - - private String accountId; - - private String executionRoleArn; - - private boolean eventLeftScope; - - /** - * default constructor - */ - public ConfigEvent() {} - - /** - * Gets the AWS Config event version. - * - */ - public String getVersion() { - return version; - } - - /** - * Sets the AWS Config event version. - * @param version String containing the event version. - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * @param version config event version - * @return Config Event - */ - public ConfigEvent withVersion(String version) { - setVersion(version); - return this; - } - - /** - * Gets the JSON-encoded notification published by AWS Config. - * - */ - public String getInvokingEvent() { - return invokingEvent; - } - - /** - * Sets the JSON-encoded notification published by AWS Config. - * @param invokingEvent String containing the notification published by AWS Config. - */ - public void setInvokingEvent(String invokingEvent) { - this.invokingEvent = invokingEvent; - } - - /** - * @param invokingEvent invoking event - * @return Config Event - */ - public ConfigEvent withInvokingEvent(String invokingEvent) { - setInvokingEvent(invokingEvent); - return this; - } - - /** - * Gets the JSON-encoded map containing the AWS Config rule parameters. - * - */ - public String getRuleParameters() { - return ruleParameters; - } - - /** - * Sets the JSON-encoded map containing the AWS Config rule parameters. - * @param ruleParameters String containing the AWS Config rule parameters. - */ - public void setRuleParameters(String ruleParameters) { - this.ruleParameters = ruleParameters; - } - - /** - * @param ruleParameters String with rule parameters - * @return ConfigEvent - */ - public ConfigEvent withRuleParameters(String ruleParameters) { - setRuleParameters(ruleParameters); - return this; - } - - /** - * Gets the token associated with the invocation of the AWS Config rule's Lambda function. - * - */ - public String getResultToken() { - return resultToken; - } - - /** - * Sets the token associated with the invocation of the AWS Config rule's Lambda function. - * @param resultToken String containing the token associated to the invocation. - */ - public void setResultToken(String resultToken) { - this.resultToken = resultToken; - } - - /** - * @param resultToken result token - * @return ConfigEvent - */ - public ConfigEvent withResultToken(String resultToken) { - setResultToken(resultToken); - return this; - } - - /** - * Gets the ARN of the AWS Config rule that triggered the event. - * - */ - public String getConfigRuleArn() { - return configRuleArn; - } - /** - * Sets the ARN of the AWS Config rule that triggered the event. - * @param configRuleArn String containing the AWS Config rule ARN. + * The AWS Config event version. + * */ - public void setConfigRuleArn(String configRuleArn) { - this.configRuleArn = configRuleArn; - } + private String version; /** - * @param configRuleArn config rule for arn - * @return ConfigEvent - */ - public ConfigEvent withConfigRuleArn(String configRuleArn) { - setConfigRuleArn(configRuleArn); - return this; - } - - /** - * Gets the ID of the AWS Config rule that triggered the event. - * + * The JSON-encoded notification published by AWS Config. + * */ - public String getConfigRuleId() { - return configRuleId; - } + private String invokingEvent; /** - * Sets the ID of the AWS Config rule that triggered the event. - * @param configRuleId String containing the AWS Config rule ID. + * The JSON-encoded map containing the AWS Config rule parameters. + * */ - public void setConfigRuleId(String configRuleId) { - this.configRuleId = configRuleId; - } + private String ruleParameters; /** - * @param configRuleId config rule id - * @return ConfigEvent - */ - public ConfigEvent withConfigRuleId(String configRuleId) { - setConfigRuleId(configRuleId); - return this; - } - - /** - * Gets the name of the AWS Config rule that triggered the event. - * + * The token associated with the invocation of the AWS Config rule's Lambda function. + * */ - public String getConfigRuleName() { - return configRuleName; - } + private String resultToken; /** - * Sets the name of the AWS Config rule that triggered the event. - * @param configRuleName String containing the AWS Config rule name. + * The ARN of the AWS Config rule that triggered the event. + * */ - public void setConfigRuleName(String configRuleName) { - this.configRuleName = configRuleName; - } + private String configRuleArn; /** - * @param configRuleName config rule name - * @return ConfigEvent - */ - public ConfigEvent withConfigRuleName(String configRuleName) { - setConfigRuleName(configRuleName); - return this; - } - - /** - * Gets the account ID of the AWS Config rule that triggered the event. - * + * The ID of the AWS Config rule that triggered the event. + * */ - public String getAccountId() { - return accountId; - } + private String configRuleId; /** - * Sets the account ID of the AWS Config rule that triggered the event. - * @param accountId String containing the account ID of the AWS Config rule. + * The name of the AWS Config rule that triggered the event. + * */ - public void setAccountId(String accountId) { - this.accountId = accountId; - } + private String configRuleName; /** - * @param accountId Account id - * @return Config Event - */ - public ConfigEvent withAccountId(String accountId) { - setAccountId(accountId); - return this; - } - - /** - * Gets the ARN of the IAM role that is assigned to AWS Config. - * + * The account ID of the AWS Config rule that triggered the event. + * */ - public String getExecutionRoleArn() { - return executionRoleArn; - } + private String accountId; /** - * Sets the ARN of the IAM role that is assigned to AWS Config. - * @param executionRoleArn String containing the IAM role assigned to AWS Config. + * The ARN of the IAM role that is assigned to AWS Config. + * */ - public void setExecutionRoleArn(String executionRoleArn) { - this.executionRoleArn = executionRoleArn; - } + private String executionRoleArn; - /** - * @param executionRoleArn execution role arn - * @return ConfigEvent - */ - public ConfigEvent withExecutionRoleArn(String executionRoleArn) { - setExecutionRoleArn(executionRoleArn); - return this; - } - /** * Whether the AWS resource to be evaluated has been removed from the AWS Config rule's scope. - * - */ - public boolean getEventLeftScope() { - return eventLeftScope; - } - - /** - * Sets whether the AWS resource to be evaluated has been removed from the AWS Config rule's scope. - * @param eventLeftScope Boolean flag indicating that the resource is no longer in scope. - */ - public void setEventLeftScope(boolean eventLeftScope) { - this.eventLeftScope = eventLeftScope; - } - - /** - * @param eventLeftScope event left scope - * @return ConfigEvent - */ - public ConfigEvent withEventLeftScope(Boolean eventLeftScope) { - setEventLeftScope(eventLeftScope); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. * - * @see Object#toString() */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getAccountId() != null) - sb.append("accountId: ").append(getAccountId()).append(","); - if (getConfigRuleArn() != null) - sb.append("configRuleArn: ").append(getConfigRuleArn()).append(","); - if (getConfigRuleId() != null) - sb.append("configRulelId: ").append(getConfigRuleId()).append(","); - if (getConfigRuleName() != null) - sb.append("configRuleName: ").append(getConfigRuleName()).append(","); - sb.append("eventLeftScope: ").append(getEventLeftScope()).append(","); - if (getExecutionRoleArn() != null) - sb.append("executionRoleArn: ").append(getExecutionRoleArn()).append(","); - if (getInvokingEvent() != null) - sb.append("invokingEvent: ").append(getInvokingEvent()).append(","); - if (getResultToken() != null) - sb.append("resultToken: ").append(getResultToken()).append(","); - if (getRuleParameters() != null) - sb.append("ruleParameters: ").append(getRuleParameters()).append(","); - if (getVersion() != null) - sb.append("version: ").append(getVersion()); - sb.append("}"); - return sb.toString(); - } - - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((accountId == null) ? 0 : accountId.hashCode()); - result = prime * result + ((configRuleArn == null) ? 0 : configRuleArn.hashCode()); - result = prime * result + ((configRuleId == null) ? 0 : configRuleId.hashCode()); - result = prime * result + ((configRuleName == null) ? 0 : configRuleName.hashCode()); - result = prime * result + (eventLeftScope ? 1231 : 1237); - result = prime * result + ((executionRoleArn == null) ? 0 : executionRoleArn.hashCode()); - result = prime * result + ((invokingEvent == null) ? 0 : invokingEvent.hashCode()); - result = prime * result + ((resultToken == null) ? 0 : resultToken.hashCode()); - result = prime * result + ((ruleParameters == null) ? 0 : ruleParameters.hashCode()); - result = prime * result + ((version == null) ? 0 : version.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - ConfigEvent other = (ConfigEvent) obj; - if (accountId == null) { - if (other.accountId != null) - return false; - } else if (!accountId.equals(other.accountId)) - return false; - if (configRuleArn == null) { - if (other.configRuleArn != null) - return false; - } else if (!configRuleArn.equals(other.configRuleArn)) - return false; - if (configRuleId == null) { - if (other.configRuleId != null) - return false; - } else if (!configRuleId.equals(other.configRuleId)) - return false; - if (configRuleName == null) { - if (other.configRuleName != null) - return false; - } else if (!configRuleName.equals(other.configRuleName)) - return false; - if (eventLeftScope != other.eventLeftScope) - return false; - if (executionRoleArn == null) { - if (other.executionRoleArn != null) - return false; - } else if (!executionRoleArn.equals(other.executionRoleArn)) - return false; - if (invokingEvent == null) { - if (other.invokingEvent != null) - return false; - } else if (!invokingEvent.equals(other.invokingEvent)) - return false; - if (resultToken == null) { - if (other.resultToken != null) - return false; - } else if (!resultToken.equals(other.resultToken)) - return false; - if (ruleParameters == null) { - if (other.ruleParameters != null) - return false; - } else if (!ruleParameters.equals(other.ruleParameters)) - return false; - if (version == null) { - if (other.version != null) - return false; - } else if (!version.equals(other.version)) - return false; - return true; - } + private boolean eventLeftScope; @Override public ConfigEvent clone() { diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ConnectEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ConnectEvent.java index 38547ac2..17596a0b 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ConnectEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ConnectEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -10,6 +10,7 @@ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ + package com.amazonaws.services.lambda.runtime.events; import lombok.AllArgsConstructor; @@ -17,6 +18,8 @@ import lombok.Data; import lombok.NoArgsConstructor; +import com.fasterxml.jackson.annotation.JsonProperty; + import java.io.Serializable; import java.util.Map; @@ -34,7 +37,10 @@ @AllArgsConstructor public class ConnectEvent implements Serializable, Cloneable { + @JsonProperty("Details") private Details details; + + @JsonProperty("Name") private String name; @Data @@ -42,8 +48,12 @@ public class ConnectEvent implements Serializable, Cloneable { @NoArgsConstructor @AllArgsConstructor public static class Details implements Serializable, Cloneable { + + @JsonProperty("ContactData") private ContactData contactData; - private Map parameters; + + @JsonProperty("Parameters") + private Map parameters; } @Data @@ -51,15 +61,35 @@ public static class Details implements Serializable, Cloneable { @NoArgsConstructor @AllArgsConstructor public static class ContactData implements Serializable, Cloneable { + + @JsonProperty("Attributes") private Map attributes; + + @JsonProperty("Channel") private String channel; + + @JsonProperty("ContactId") private String contactId; + + @JsonProperty("CustomerEndpoint") private CustomerEndpoint customerEndpoint; + + @JsonProperty("InitialContactId") private String initialContactId; + + @JsonProperty("InitiationMethod") private String initiationMethod; + + @JsonProperty("InstanceARN") private String instanceArn; + + @JsonProperty("PreviousContactId") private String previousContactId; + + @JsonProperty("Queue") private String queue; + + @JsonProperty("SystemEndpoint") private SystemEndpoint systemEndpoint; } @@ -68,7 +98,11 @@ public static class ContactData implements Serializable, Cloneable { @NoArgsConstructor @AllArgsConstructor public static class CustomerEndpoint implements Serializable, Cloneable { + + @JsonProperty("Address") private String address; + + @JsonProperty("Type") private String type; } @@ -77,7 +111,11 @@ public static class CustomerEndpoint implements Serializable, Cloneable { @NoArgsConstructor @AllArgsConstructor public static class SystemEndpoint implements Serializable, Cloneable { + + @JsonProperty("Address") private String address; + + @JsonProperty("Type") private String type; } } diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/DynamodbEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/DynamodbEvent.java deleted file mode 100644 index 353f587f..00000000 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/DynamodbEvent.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with - * the License. A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR - * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions - * and limitations under the License. - */ -package com.amazonaws.services.lambda.runtime.events; - -import java.io.Serializable; -import java.util.List; - -/** - * Represents an Amazon DynamoDB event - */ -public class DynamodbEvent implements Serializable, Cloneable { - - private static final long serialVersionUID = -2354616079899981231L; - - private List records; - - /** - * The unit of data of an Amazon DynamoDB event - */ - public static class DynamodbStreamRecord extends com.amazonaws.services.lambda.runtime.events.models.dynamodb.Record { - - private static final long serialVersionUID = 3638381544604354963L; - - private String eventSourceARN; - - /** - * default constructor - * (Not available in v1) - */ - public DynamodbStreamRecord() {} - - /** - * Gets the event source arn of DynamoDB - * @return event source arn - */ - public String getEventSourceARN() { - return eventSourceARN; - } - - /** - * Sets the event source arn of DynamoDB - * @param eventSourceARN A string containing the event source arn - */ - public void setEventSourceARN(String eventSourceARN) { - this.eventSourceARN = eventSourceARN; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getEventID() != null) - sb.append("eventID: ").append(getEventID()).append(","); - if (getEventName() != null) - sb.append("eventName: ").append(getEventName()).append(","); - if (getEventVersion() != null) - sb.append("eventVersion: ").append(getEventVersion()).append(","); - if (getEventSource() != null) - sb.append("eventSource: ").append(getEventSource()).append(","); - if (getAwsRegion() != null) - sb.append("awsRegion: ").append(getAwsRegion()).append(","); - if (getDynamodb() != null) - sb.append("dynamodb: ").append(getDynamodb()).append(","); - if (getUserIdentity() != null) - sb.append("userIdentity: ").append(getUserIdentity()).append(","); - if (getEventSourceARN() != null) - sb.append("eventSourceArn: ").append(getEventSourceARN()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof DynamodbStreamRecord == false) - return false; - DynamodbStreamRecord other = (DynamodbStreamRecord) obj; - if (other.getEventID() == null ^ this.getEventID() == null) - return false; - if (other.getEventID() != null && other.getEventID().equals(this.getEventID()) == false) - return false; - if (other.getEventName() == null ^ this.getEventName() == null) - return false; - if (other.getEventName() != null && other.getEventName().equals(this.getEventName()) == false) - return false; - if (other.getEventVersion() == null ^ this.getEventVersion() == null) - return false; - if (other.getEventVersion() != null && other.getEventVersion().equals(this.getEventVersion()) == false) - return false; - if (other.getEventSource() == null ^ this.getEventSource() == null) - return false; - if (other.getEventSource() != null && other.getEventSource().equals(this.getEventSource()) == false) - return false; - if (other.getAwsRegion() == null ^ this.getAwsRegion() == null) - return false; - if (other.getAwsRegion() != null && other.getAwsRegion().equals(this.getAwsRegion()) == false) - return false; - if (other.getDynamodb() == null ^ this.getDynamodb() == null) - return false; - if (other.getDynamodb() != null && other.getDynamodb().equals(this.getDynamodb()) == false) - return false; - if (other.getUserIdentity() == null ^ this.getUserIdentity() == null) - return false; - if (other.getUserIdentity() != null && other.getUserIdentity().equals(this.getUserIdentity()) == false) - return false; - if (other.getEventSourceARN() == null ^ this.getEventSourceARN() == null) - return false; - if (other.getEventSourceARN() != null && other.getEventSourceARN().equals(this.getEventSourceARN()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = super.hashCode(); - - hashCode = prime * hashCode + ((getEventSourceARN() == null) ? 0 : getEventSourceARN().hashCode()); - return hashCode; - } - - @Override - public DynamodbStreamRecord clone() { - return (DynamodbStreamRecord) super.clone(); - } - - } - - /** - * default constructor - * (Not available in v1) - */ - public DynamodbEvent() {} - - /** - * Gets the list of DynamoDB event records - * @return list of dynamodb event records - */ - public List getRecords() { - return records; - } - - /** - * Sets the list of DynamoDB event records - * @param records a list of DynamoDb event records - */ - public void setRecords(List records) { - this.records = records; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getRecords() != null) - sb.append(getRecords()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof DynamodbEvent == false) - return false; - DynamodbEvent other = (DynamodbEvent) obj; - if (other.getRecords() == null ^ this.getRecords() == null) - return false; - if (other.getRecords() != null && other.getRecords().equals(this.getRecords()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getRecords() == null) ? 0 : getRecords().hashCode()); - return hashCode; - } - - @Override - public DynamodbEvent clone() { - try { - return (DynamodbEvent) super.clone(); - } catch (CloneNotSupportedException e) { - throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e); - } - } - -} diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/IamPolicyResponse.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/IamPolicyResponse.java index e8d3b13d..ea01dcd1 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/IamPolicyResponse.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/IamPolicyResponse.java @@ -1,3 +1,16 @@ +/* + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with + * the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + package com.amazonaws.services.lambda.runtime.events; import lombok.AllArgsConstructor; @@ -5,7 +18,11 @@ import lombok.Data; import lombok.NoArgsConstructor; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; + import java.io.Serializable; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -22,7 +39,7 @@ @Builder(setterPrefix = "with") @NoArgsConstructor @AllArgsConstructor -public class IamPolicyResponse implements Serializable, Cloneable { +public class IamPolicyResponse implements Serializable { public static final String EXECUTE_API_INVOKE = "execute-api:Invoke"; public static final String VERSION_2012_10_17 = "2012-10-17"; @@ -33,7 +50,8 @@ public class IamPolicyResponse implements Serializable, Cloneable { private PolicyDocument policyDocument; private Map context; - public Map getPolicyDocument() { + @JsonIgnore + public Map getPolicyDocumentData() { Map serializablePolicy = new HashMap<>(); serializablePolicy.put("Version", policyDocument.getVersion()); @@ -52,19 +70,19 @@ public Map getPolicyDocument() { return serializablePolicy; } - public static Statement allowStatement(String resource) { - return Statement.builder() + public static IamPolicyResponseV1.Statement allowStatement(String resource) { + return IamPolicyResponseV1.Statement.builder() .withEffect(ALLOW) .withResource(Collections.singletonList(resource)) - .withAction(EXECUTE_API_INVOKE) + .withAction(Arrays.asList(EXECUTE_API_INVOKE)) .build(); } - public static Statement denyStatement(String resource) { - return Statement.builder() + public static IamPolicyResponseV1.Statement denyStatement(String resource) { + return IamPolicyResponseV1.Statement.builder() .withEffect(DENY) .withResource(Collections.singletonList(resource)) - .withAction(EXECUTE_API_INVOKE) + .withAction(Arrays.asList(EXECUTE_API_INVOKE)) .build(); } @@ -74,7 +92,9 @@ public static Statement denyStatement(String resource) { @AllArgsConstructor public static class PolicyDocument implements Serializable, Cloneable { + @JsonProperty("Version") private String version; + @JsonProperty("Statement") private List statement; } @@ -84,9 +104,13 @@ public static class PolicyDocument implements Serializable, Cloneable { @AllArgsConstructor public static class Statement implements Serializable, Cloneable { - private String action; + @JsonProperty("Action") + private List action; + @JsonProperty("Effect") private String effect; + @JsonProperty("Resource") private List resource; + @JsonProperty("Condition") private Map> condition; } } \ No newline at end of file diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/IamPolicyResponseV1.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/IamPolicyResponseV1.java index a4316536..f2d0f0b6 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/IamPolicyResponseV1.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/IamPolicyResponseV1.java @@ -1,3 +1,16 @@ +/* + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with + * the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + package com.amazonaws.services.lambda.runtime.events; import lombok.AllArgsConstructor; @@ -5,7 +18,11 @@ import lombok.Data; import lombok.NoArgsConstructor; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; + import java.io.Serializable; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -22,7 +39,7 @@ @Builder(setterPrefix = "with") @NoArgsConstructor @AllArgsConstructor -public class IamPolicyResponseV1 implements Serializable, Cloneable { +public class IamPolicyResponseV1 implements Serializable { public static final String EXECUTE_API_INVOKE = "execute-api:Invoke"; public static final String VERSION_2012_10_17 = "2012-10-17"; @@ -34,7 +51,8 @@ public class IamPolicyResponseV1 implements Serializable, Cloneable { private Map context; private String usageIdentifierKey; - public Map getPolicyDocument() { + @JsonIgnore + public Map getPolicyDocumentData() { Map serializablePolicy = new HashMap<>(); serializablePolicy.put("Version", policyDocument.getVersion()); @@ -57,7 +75,7 @@ public static Statement allowStatement(String resource) { return Statement.builder() .withEffect(ALLOW) .withResource(Collections.singletonList(resource)) - .withAction(EXECUTE_API_INVOKE) + .withAction(Arrays.asList(EXECUTE_API_INVOKE)) .build(); } @@ -65,7 +83,7 @@ public static Statement denyStatement(String resource) { return Statement.builder() .withEffect(DENY) .withResource(Collections.singletonList(resource)) - .withAction(EXECUTE_API_INVOKE) + .withAction(Arrays.asList(EXECUTE_API_INVOKE)) .build(); } @@ -73,9 +91,11 @@ public static Statement denyStatement(String resource) { @Builder(setterPrefix = "with") @NoArgsConstructor @AllArgsConstructor - public static class PolicyDocument implements Serializable, Cloneable { + public static class PolicyDocument implements Serializable { + @JsonProperty("Version") private String version; + @JsonProperty("Statement") private List statement; } @@ -83,11 +103,15 @@ public static class PolicyDocument implements Serializable, Cloneable { @Builder(setterPrefix = "with") @NoArgsConstructor @AllArgsConstructor - public static class Statement implements Serializable, Cloneable { + public static class Statement implements Serializable { - private String action; + @JsonProperty("Action") + private List action; + @JsonProperty("Effect") private String effect; + @JsonProperty("Resource") private List resource; + @JsonProperty("Condition") private Map> condition; } } \ No newline at end of file diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/IoTButtonEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/IoTButtonEvent.java index 2459d7cd..e693ef28 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/IoTButtonEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/IoTButtonEvent.java @@ -1,10 +1,33 @@ +/* + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with + * the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + package com.amazonaws.services.lambda.runtime.events; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + import java.io.Serializable; /** * represents a click of an IoT Button */ + +@Data +@Builder(setterPrefix = "with") +@NoArgsConstructor +@AllArgsConstructor public class IoTButtonEvent implements Serializable, Cloneable { private static final long serialVersionUID = 8699582353606993478L; @@ -15,136 +38,6 @@ public class IoTButtonEvent implements Serializable, Cloneable { private String batteryVoltage; - /** - * default constructor - */ - public IoTButtonEvent() {} - - /** - * @return serial number - */ - public String getSerialNumber() { - return serialNumber; - } - - /** - * @param serialNumber serial number - */ - public void setSerialNumber(String serialNumber) { - this.serialNumber = serialNumber; - } - - /** - * @param serialNumber serial number - * @return IotButtonEvent - */ - public IoTButtonEvent withSerialNumber(String serialNumber) { - setSerialNumber(serialNumber); - return this; - } - - /** - * @return click type - */ - public String getClickType() { - return clickType; - } - - /** - * @param clickType click type - */ - public void setClickType(String clickType) { - this.clickType = clickType; - } - - /** - * @param clickType click type - * @return IoTButtonEvent - */ - public IoTButtonEvent withClickType(String clickType) { - setClickType(clickType); - return this; - } - - /** - * @return battery voltage - */ - public String getBatteryVoltage() { - return batteryVoltage; - } - - /** - * @param batteryVoltage battery voltage - */ - public void setBatteryVoltage(String batteryVoltage) { - this.batteryVoltage = batteryVoltage; - } - - /** - * @param batteryVoltage battery voltage - * @return IoTButtonEvent - */ - public IoTButtonEvent withBatteryVoltage(String batteryVoltage) { - setBatteryVoltage(batteryVoltage); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getSerialNumber() != null) - sb.append("serialNumber: ").append(getSerialNumber()).append(","); - if (getClickType() != null) - sb.append("clickType: ").append(getClickType()).append(","); - if (getBatteryVoltage() != null) - sb.append("batteryVoltage: ").append(getBatteryVoltage()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof IoTButtonEvent == false) - return false; - IoTButtonEvent other = (IoTButtonEvent) obj; - if (other.getSerialNumber() == null ^ this.getSerialNumber() == null) - return false; - if (other.getSerialNumber() != null && other.getSerialNumber().equals(this.getSerialNumber()) == false) - return false; - if (other.getClickType() == null ^ this.getClickType() == null) - return false; - if (other.getClickType() != null && other.getClickType().equals(this.getClickType()) == false) - return false; - if (other.getBatteryVoltage() == null ^ this.getBatteryVoltage() == null) - return false; - if (other.getBatteryVoltage() != null && other.getBatteryVoltage().equals(this.getBatteryVoltage()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - hashCode = prime * hashCode + ((getSerialNumber() == null) ? 0 : getSerialNumber().hashCode()); - hashCode = prime * hashCode + ((getClickType() == null) ? 0 : getClickType().hashCode()); - hashCode = prime * hashCode + ((getBatteryVoltage() == null) ? 0 : getBatteryVoltage().hashCode()); - return hashCode; - } - @Override public IoTButtonEvent clone() { try { diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/KafkaEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/KafkaEvent.java index dd051d48..48b96779 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/KafkaEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/KafkaEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -10,6 +10,7 @@ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ + package com.amazonaws.services.lambda.runtime.events; import lombok.AllArgsConstructor; @@ -29,7 +30,7 @@ public class KafkaEvent { private String eventSource; private String eventSourceArn; private String bootstrapServers; - + @Data @NoArgsConstructor @AllArgsConstructor diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/KinesisAnalyticsFirehoseInputPreprocessingEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/KinesisAnalyticsFirehoseInputPreprocessingEvent.java deleted file mode 100644 index 548bd061..00000000 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/KinesisAnalyticsFirehoseInputPreprocessingEvent.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 2012-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with - * the License. A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR - * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions - * and limitations under the License. - */ -package com.amazonaws.services.lambda.runtime.events; - -import java.io.Serializable; -import java.nio.ByteBuffer; -import java.util.List; - -/** - * Event model for pre-processing Kinesis Firehose records through Kinesis - * Analytics Lambda pre-processing function. - */ -public class KinesisAnalyticsFirehoseInputPreprocessingEvent implements Serializable { - private static final long serialVersionUID = 3372554211277515302L; - public String invocationId; - public String applicationArn; - public String streamArn; - public List records; - - public KinesisAnalyticsFirehoseInputPreprocessingEvent() { - } - - public KinesisAnalyticsFirehoseInputPreprocessingEvent(String invocationId, String applicationArn, String streamArn, - List records) { - super(); - this.invocationId = invocationId; - this.applicationArn = applicationArn; - this.streamArn = streamArn; - this.records = records; - } - - public String getInvocationId() { - return invocationId; - } - - public void setInvocationId(String invocationId) { - this.invocationId = invocationId; - } - - public String getApplicationArn() { - return applicationArn; - } - - public void setApplicationArn(String applicationArn) { - this.applicationArn = applicationArn; - } - - public String getStreamArn() { - return streamArn; - } - - public void setStreamArn(String streamArn) { - this.streamArn = streamArn; - } - - public List getRecords() { - return records; - } - - public void setRecords(List records) { - this.records = records; - } - - public static class Record implements Serializable { - private static final long serialVersionUID = 9130920004800315787L; - public String recordId; - public KinesisFirehoseRecordMetadata kinesisFirehoseRecordMetadata; - public ByteBuffer data; - - public Record() { - } - - public Record(String recordId, KinesisFirehoseRecordMetadata kinesisFirehoseRecordMetadata, ByteBuffer data) { - super(); - this.recordId = recordId; - this.kinesisFirehoseRecordMetadata = kinesisFirehoseRecordMetadata; - this.data = data; - } - - public String getRecordId() { - return recordId; - } - - public void setRecordId(String recordId) { - this.recordId = recordId; - } - - public ByteBuffer getData() { - return data; - } - - public void setData(ByteBuffer data) { - this.data = data; - } - - public KinesisFirehoseRecordMetadata getKinesisFirehoseRecordMetadata() { - return kinesisFirehoseRecordMetadata; - } - - public void setKinesisFirehoseRecordMetadata(KinesisFirehoseRecordMetadata kinesisFirehoseRecordMetadata) { - this.kinesisFirehoseRecordMetadata = kinesisFirehoseRecordMetadata; - } - - public static class KinesisFirehoseRecordMetadata implements Serializable { - private static final long serialVersionUID = 692430771749481045L; - public Long approximateArrivalTimestamp; - - public KinesisFirehoseRecordMetadata() { - } - - public KinesisFirehoseRecordMetadata(Long approximateArrivalTimestamp) { - super(); - this.approximateArrivalTimestamp = approximateArrivalTimestamp; - } - - public Long getApproximateArrivalTimestamp() { - return approximateArrivalTimestamp; - } - - public void setApproximateArrivalTimestamp(Long approximateArrivalTimestamp) { - this.approximateArrivalTimestamp = approximateArrivalTimestamp; - } - } - } -} \ No newline at end of file diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/KinesisAnalyticsOutputDeliveryEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/KinesisAnalyticsOutputDeliveryEvent.java deleted file mode 100644 index 311e48cb..00000000 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/KinesisAnalyticsOutputDeliveryEvent.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2012-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with - * the License. A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR - * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions - * and limitations under the License. - */ -package com.amazonaws.services.lambda.runtime.events; - -import java.io.Serializable; -import java.nio.ByteBuffer; -import java.util.List; - -/** - * Event model for Kinesis Analytics Lambda output delivery. - */ -public class KinesisAnalyticsOutputDeliveryEvent implements Serializable { - private static final long serialVersionUID = -276093256265202318L; - public String invocationId; - public String applicationArn; - public List records; - - public KinesisAnalyticsOutputDeliveryEvent() { - } - - public KinesisAnalyticsOutputDeliveryEvent(String invocationId, String applicationArn, List records) { - super(); - this.invocationId = invocationId; - this.applicationArn = applicationArn; - this.records = records; - } - - public String getInvocationId() { - return invocationId; - } - - public void setInvocationId(String invocationId) { - this.invocationId = invocationId; - } - - public String getApplicationArn() { - return applicationArn; - } - - public void setApplicationArn(String applicationArn) { - this.applicationArn = applicationArn; - } - - public List getRecords() { - return records; - } - - public void setRecords(List records) { - this.records = records; - } - - public static class Record implements Serializable { - private static final long serialVersionUID = -3545295536239762069L; - public String recordId; - public LambdaDeliveryRecordMetadata lambdaDeliveryRecordMetadata; - public ByteBuffer data; - - public Record() { - } - - public Record(String recordId, LambdaDeliveryRecordMetadata lambdaDeliveryRecordMetadata, ByteBuffer data) { - super(); - this.recordId = recordId; - this.lambdaDeliveryRecordMetadata = lambdaDeliveryRecordMetadata; - this.data = data; - } - - public String getRecordId() { - return recordId; - } - - public void setRecordId(String recordId) { - this.recordId = recordId; - } - - public ByteBuffer getData() { - return data; - } - - public void setData(ByteBuffer data) { - this.data = data; - } - - public LambdaDeliveryRecordMetadata getLambdaDeliveryRecordMetadata() { - return lambdaDeliveryRecordMetadata; - } - - public void setLambdaDeliveryRecordMetadata(LambdaDeliveryRecordMetadata lambdaDeliveryRecordMetadata) { - this.lambdaDeliveryRecordMetadata = lambdaDeliveryRecordMetadata; - } - - public static class LambdaDeliveryRecordMetadata implements Serializable { - private static final long serialVersionUID = -3809303175070680370L; - public long retryHint; - - public LambdaDeliveryRecordMetadata() { - } - - public LambdaDeliveryRecordMetadata(long retryHint) { - super(); - this.retryHint = retryHint; - } - - public long getRetryHint() { - return retryHint; - } - - public void setRetryHint(long retryHint) { - this.retryHint = retryHint; - } - } - } -} \ No newline at end of file diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/KinesisAnalyticsStreamsInputPreprocessingEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/KinesisAnalyticsStreamsInputPreprocessingEvent.java deleted file mode 100644 index b63a208a..00000000 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/KinesisAnalyticsStreamsInputPreprocessingEvent.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright 2012-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with - * the License. A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR - * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions - * and limitations under the License. - */ -package com.amazonaws.services.lambda.runtime.events; - -import java.io.Serializable; -import java.nio.ByteBuffer; -import java.util.List; - -/** - * Event model for pre-processing Kinesis Streams records through Kinesis - * Analytics Lambda pre-processing function. - */ -public class KinesisAnalyticsStreamsInputPreprocessingEvent implements Serializable { - private static final long serialVersionUID = 1770320710876513596L; - public String invocationId; - public String applicationArn; - public String streamArn; - public List records; - - public KinesisAnalyticsStreamsInputPreprocessingEvent() { - } - - public KinesisAnalyticsStreamsInputPreprocessingEvent(String invocationId, String applicationArn, String streamArn, - List records) { - super(); - this.invocationId = invocationId; - this.applicationArn = applicationArn; - this.streamArn = streamArn; - this.records = records; - } - - public String getInvocationId() { - return invocationId; - } - - public void setInvocationId(String invocationId) { - this.invocationId = invocationId; - } - - public String getApplicationArn() { - return applicationArn; - } - - public void setApplicationArn(String applicationArn) { - this.applicationArn = applicationArn; - } - - public String getStreamArn() { - return streamArn; - } - - public void setStreamArn(String streamArn) { - this.streamArn = streamArn; - } - - public List getRecords() { - return records; - } - - public void setRecords(List records) { - this.records = records; - } - - public static class Record implements Serializable { - private static final long serialVersionUID = -2070268774061223434L; - public String recordId; - public KinesisStreamRecordMetadata kinesisStreamRecordMetadata; - public ByteBuffer data; - - public Record() { - } - - public Record(String recordId, KinesisStreamRecordMetadata kinesisStreamRecordMetadata, ByteBuffer data) { - super(); - this.recordId = recordId; - this.kinesisStreamRecordMetadata = kinesisStreamRecordMetadata; - this.data = data; - } - - public String getRecordId() { - return recordId; - } - - public void setRecordId(String recordId) { - this.recordId = recordId; - } - - public ByteBuffer getData() { - return data; - } - - public void setData(ByteBuffer data) { - this.data = data; - } - - public KinesisStreamRecordMetadata getKinesisStreamRecordMetadata() { - return kinesisStreamRecordMetadata; - } - - public void setKinesisStreamRecordMetadata(KinesisStreamRecordMetadata kinesisStreamRecordMetadata) { - this.kinesisStreamRecordMetadata = kinesisStreamRecordMetadata; - } - - public static class KinesisStreamRecordMetadata implements Serializable { - private static final long serialVersionUID = 8831719215562345916L; - public String sequenceNumber; - public String partitionKey; - public String shardId; - public Long approximateArrivalTimestamp; - - public KinesisStreamRecordMetadata() { - } - - public KinesisStreamRecordMetadata(String sequenceNumber, String partitionKey, String shardId, - Long approximateArrivalTimestamp) { - super(); - this.sequenceNumber = sequenceNumber; - this.partitionKey = partitionKey; - this.shardId = shardId; - this.approximateArrivalTimestamp = approximateArrivalTimestamp; - } - - public String getSequenceNumber() { - return sequenceNumber; - } - - public void setSequenceNumber(String sequenceNumber) { - this.sequenceNumber = sequenceNumber; - } - - public String getPartitionKey() { - return partitionKey; - } - - public void setPartitionKey(String partitionKey) { - this.partitionKey = partitionKey; - } - - public String getShardId() { - return shardId; - } - - public void setShardId(String shardId) { - this.shardId = shardId; - } - - public Long getApproximateArrivalTimestamp() { - return approximateArrivalTimestamp; - } - - public void setApproximateArrivalTimestamp(Long approximateArrivalTimestamp) { - this.approximateArrivalTimestamp = approximateArrivalTimestamp; - } - } - } -} \ No newline at end of file diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/KinesisEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/KinesisEvent.java deleted file mode 100644 index cce37803..00000000 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/KinesisEvent.java +++ /dev/null @@ -1,474 +0,0 @@ -/* - * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with - * the License. A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR - * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions - * and limitations under the License. - */ -package com.amazonaws.services.lambda.runtime.events; - -import java.io.Serializable; -import java.util.List; - -/** - * Represents an Amazon Kinesis event. - */ -public class KinesisEvent implements Serializable, Cloneable { - - private static final long serialVersionUID = 8145257839787754632L; - - private List records; - - /** - * The unit of data of an Amazon Kinesis stream - */ - public static class Record extends com.amazonaws.services.lambda.runtime.events.models.kinesis.Record { - - private static final long serialVersionUID = 7856672931457425976L; - - private String kinesisSchemaVersion; - - /** - * default constructor - * (Not available in v1) - */ - public Record() {} - - /** - * Gets the schema version for the record - * @return kinesis schema version - */ - public String getKinesisSchemaVersion() { - return kinesisSchemaVersion; - } - - /** - * Sets the schema version for the record - * @param kinesisSchemaVersion A string containing the schema version - */ - public void setKinesisSchemaVersion(String kinesisSchemaVersion) { - this.kinesisSchemaVersion = kinesisSchemaVersion; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getSequenceNumber() != null) - sb.append("SequenceNumber: ").append(getSequenceNumber()).append(","); - if (getApproximateArrivalTimestamp() != null) - sb.append("ApproximateArrivalTimestamp: ").append(getApproximateArrivalTimestamp()).append(","); - if (getData() != null) - sb.append("Data: ").append(getData()).append(","); - if (getPartitionKey() != null) - sb.append("PartitionKey: ").append(getPartitionKey()).append(","); - if (getEncryptionType() != null) - sb.append("EncryptionType: ").append(getEncryptionType()).append(","); - if (getKinesisSchemaVersion() != null) - sb.append("KinesisSchemaVersion: ").append(getKinesisSchemaVersion()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof Record == false) - return false; - Record other = (Record) obj; - if (other.getSequenceNumber() == null ^ this.getSequenceNumber() == null) - return false; - if (other.getSequenceNumber() != null && other.getSequenceNumber().equals(this.getSequenceNumber()) == false) - return false; - if (other.getApproximateArrivalTimestamp() == null ^ this.getApproximateArrivalTimestamp() == null) - return false; - if (other.getApproximateArrivalTimestamp() != null && other.getApproximateArrivalTimestamp().equals(this.getApproximateArrivalTimestamp()) == false) - return false; - if (other.getData() == null ^ this.getData() == null) - return false; - if (other.getData() != null && other.getData().equals(this.getData()) == false) - return false; - if (other.getPartitionKey() == null ^ this.getPartitionKey() == null) - return false; - if (other.getPartitionKey() != null && other.getPartitionKey().equals(this.getPartitionKey()) == false) - return false; - if (other.getEncryptionType() == null ^ this.getEncryptionType() == null) - return false; - if (other.getEncryptionType() != null && other.getEncryptionType().equals(this.getEncryptionType()) == false) - return false; - if (other.getKinesisSchemaVersion() == null ^ this.getKinesisSchemaVersion() == null) - return false; - if (other.getKinesisSchemaVersion() != null && other.getKinesisSchemaVersion().equals(this.getKinesisSchemaVersion()) == false) - return false; - return true; - } - - /* (non-Javadoc) - * @see com.amazonaws.services.lambda.runtime.events.models.kinesis.Record#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((getKinesisSchemaVersion() == null) ? 0 : getKinesisSchemaVersion().hashCode()); - return result; - } - - @Override - public Record clone() { - return (Record) super.clone(); - } - } - - /** - * Kinesis event records provide contextual data about a Kinesis record - * - */ - public static class KinesisEventRecord implements Serializable, Cloneable { - - private static final long serialVersionUID = -3855723544907905206L; - - private String eventSource; - - private Record kinesis; - - private String eventID; - - private String invokeIdentityArn; - - private String eventName; - - private String eventVersion; - - private String eventSourceARN; - - private String awsRegion; - - /** - * default constructor - * (not available in v1) - */ - public KinesisEventRecord() {} - - /** - * Gets the source of the event - * @return event source - */ - public String getEventSource() { - return eventSource; - } - - /** - * Sets the source of the event - * @param eventSource A string representing the event source - */ - public void setEventSource(String eventSource) { - this.eventSource = eventSource; - } - - /** - * Gets the underlying Kinesis record associated with the event. - * @return Kinesis Record object - */ - public Record getKinesis() { - return kinesis; - } - - /** - * Sets the underlying Kinesis record associated with the event. - * @param kinesis A Kineis record object. - */ - public void setKinesis(Record kinesis) { - this.kinesis = kinesis; - } - - /** - * Gets the event id. - * @return event id - */ - public String getEventID() { - return eventID; - } - - /** - * Sets the event id - * @param eventID A string representing the event id. - */ - public void setEventID(String eventID) { - this.eventID = eventID; - } - - /** - * Gets then ARN for the identity used to invoke the Lambda Function. - * @return invoke arn - */ - public String getInvokeIdentityArn() { - return invokeIdentityArn; - } - - /** - * Sets an ARN for the identity used to invoke the Lambda Function. - * @param invokeIdentityArn A string representing the invoke identity ARN - */ - public void setInvokeIdentityArn(String invokeIdentityArn) { - this.invokeIdentityArn = invokeIdentityArn; - } - - /** - * Gets the name of the event - * @return event name - */ - public String getEventName() { - return eventName; - } - - /** - * Sets the name of the event - * @param eventName A string containing the event name - */ - public void setEventName(String eventName) { - this.eventName = eventName; - } - - /** - * Gets the event version - * @return event version - */ - public String getEventVersion() { - return eventVersion; - } - - /** - * Sets the event version - * @param eventVersion A string containing the event version - */ - public void setEventVersion(String eventVersion) { - this.eventVersion = eventVersion; - } - - /** - * Gets the ARN of the event source - * @return event source arn - */ - public String getEventSourceARN() { - return eventSourceARN; - } - - /** - * Sets the ARN of the event source - * @param eventSourceARN A string containing the event source ARN - */ - public void setEventSourceARN(String eventSourceARN) { - this.eventSourceARN = eventSourceARN; - } - - /** - * Gets the AWS region where the event originated - * @return aws region - */ - public String getAwsRegion() { - return awsRegion; - } - - /** - * Sets the AWS region where the event originated - * @param awsRegion A string containing the AWS region - */ - public void setAwsRegion(String awsRegion) { - this.awsRegion = awsRegion; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getEventSource() != null) - sb.append("eventSource: ").append(getEventSource()).append(","); - if (getKinesis() != null) - sb.append("kinesis: ").append(getKinesis().toString()).append(","); - if (getEventID() != null) - sb.append("eventId: ").append(getEventID()).append(","); - if (getInvokeIdentityArn() != null) - sb.append("invokeIdentityArn: ").append(getInvokeIdentityArn()).append(","); - if (getEventName() != null) - sb.append("eventName: ").append(getEventName()).append(","); - if (getEventVersion() != null) - sb.append("eventVersion: ").append(getEventVersion()).append(","); - if (getEventSourceARN() != null) - sb.append("eventSourceARN: ").append(getEventSourceARN()).append(","); - if (getAwsRegion() != null) - sb.append("awsRegion: ").append(getAwsRegion()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof KinesisEventRecord == false) - return false; - KinesisEventRecord other = (KinesisEventRecord) obj; - if (other.getEventSource() == null ^ this.getEventSource() == null) - return false; - if (other.getEventSource() != null && other.getEventSource().equals(this.getEventSource()) == false) - return false; - if (other.getKinesis() == null ^ this.getKinesis() == null) - return false; - if (other.getKinesis() != null && other.getKinesis().equals(this.getKinesis()) == false) - return false; - if (other.getEventID() == null ^ this.getEventID() == null) - return false; - if (other.getEventID() != null && other.getEventID().equals(this.getEventID()) == false) - return false; - if (other.getInvokeIdentityArn() == null ^ this.getInvokeIdentityArn() == null) - return false; - if (other.getInvokeIdentityArn() != null && other.getInvokeIdentityArn().equals(this.getInvokeIdentityArn()) == false) - return false; - if (other.getEventName() == null ^ this.getEventName() == null) - return false; - if (other.getEventName() != null && other.getEventName().equals(this.getEventName()) == false) - return false; - if (other.getEventVersion() == null ^ this.getEventVersion() == null) - return false; - if (other.getEventVersion() != null && other.getEventVersion().equals(this.getEventVersion()) == false) - return false; - if (other.getEventSourceARN() == null ^ this.getEventSourceARN() == null) - return false; - if (other.getEventSourceARN() != null && other.getEventSourceARN().equals(this.getEventSourceARN()) == false) - return false; - if (other.getAwsRegion() == null ^ this.getAwsRegion() == null) - return false; - if (other.getAwsRegion() != null && other.getAwsRegion().equals(this.getAwsRegion()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getEventSource() == null) ? 0 : getEventSource().hashCode()); - hashCode = prime * hashCode + ((getKinesis() == null) ? 0 : getKinesis().hashCode()); - hashCode = prime * hashCode + ((getEventID() == null) ? 0 : getEventID().hashCode()); - hashCode = prime * hashCode + ((getInvokeIdentityArn() == null) ? 0 : getInvokeIdentityArn().hashCode()); - hashCode = prime * hashCode + ((getEventName() == null) ? 0 : getEventName().hashCode()); - hashCode = prime * hashCode + ((getEventVersion() == null) ? 0 : getEventVersion().hashCode()); - hashCode = prime * hashCode + ((getEventSourceARN() == null) ? 0 : getEventSourceARN().hashCode()); - hashCode = prime * hashCode + ((getAwsRegion() == null) ? 0 : getAwsRegion().hashCode()); - - return hashCode; - } - - @Override - public KinesisEventRecord clone() { - try { - return (KinesisEventRecord) super.clone(); - } catch (CloneNotSupportedException e) { - throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e); - } - } - } - - /** - * default constructor - * (Not available in v1) - */ - public KinesisEvent() {} - - /** - * Gets the list of Kinesis event records - * @return list of records - */ - public List getRecords() { - return records; - } - - /** - * Sets the list of Kinesis event records - * @param records a list of Kinesis event records - */ - public void setRecords(List records) { - this.records = records; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getRecords() != null) - sb.append(getRecords().toString()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof KinesisEvent == false) - return false; - KinesisEvent other = (KinesisEvent) obj; - if (other.getRecords() == null ^ this.getRecords() == null) - return false; - if (other.getRecords() != null && other.getRecords().equals(this.getRecords()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getRecords() == null) ? 0 : getRecords().hashCode()); - return hashCode; - } - - @Override - public KinesisEvent clone() { - try { - return (KinesisEvent) super.clone(); - } catch (CloneNotSupportedException e) { - throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e); - } - } - -} diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/KinesisFirehoseEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/KinesisFirehoseEvent.java deleted file mode 100644 index 3d787eb8..00000000 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/KinesisFirehoseEvent.java +++ /dev/null @@ -1,454 +0,0 @@ -/* - * Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with - * the License. A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR - * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions - * and limitations under the License. - */ - -package com.amazonaws.services.lambda.runtime.events; - -import java.io.Serializable; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.util.Base64; -import java.util.List; -import java.util.Map; - -/** - * Created by adsuresh on 7/13/17. - */ -public class KinesisFirehoseEvent implements Serializable, Cloneable { - - private static final long serialVersionUID = -2890373471008001695L; - - private String invocationId; - - private String deliveryStreamArn; - - private String region; - - private List records; - - public static class Record implements Serializable, Cloneable { - - private static final long serialVersionUID = -7231161900431910379L; - - /** - *

- * The data blob, which is base64-encoded when the blob is serialized. The maximum size of the data blob, before - * base64-encoding, is 1,000 KB. - *

- */ - private ByteBuffer data; - - private String recordId; - - private Long approximateArrivalEpoch; - - private Long approximateArrivalTimestamp; - - private Map kinesisRecordMetadata; - - /** - * default constructor - */ - public Record() {} - - /** - *

- * The data blob, which is base64-encoded when the blob is serialized. The maximum size of the data blob, before - * base64-encoding, is 1,000 KB. - *

- *

- * The AWS SDK for Java performs a Base64 encoding on this field before sending this request to the AWS service. - * Users of the SDK should not perform Base64 encoding on this field. - *

- *

- * Warning: ByteBuffers returned by the SDK are mutable. Changes to the content or position of the byte buffer will - * be seen by all objects that have a reference to this object. It is recommended to call ByteBuffer.duplicate() or - * ByteBuffer.asReadOnlyBuffer() before using or reading from the buffer. This behavior will be changed in a future - * major version of the SDK. - *

- * - * @param data - * The data blob, which is base64-encoded when the blob is serialized. The maximum size of the data blob, - * before base64-encoding, is 1,000 KB. - */ - public void setData(ByteBuffer data) { - this.data = data; - } - - /** - *

- * The data blob, which is base64-encoded when the blob is serialized. The maximum size of the data blob, before - * base64-encoding, is 1,000 KB. - *

- *

- * {@code ByteBuffer}s are stateful. Calling their {@code get} methods changes their {@code position}. We recommend - * using {@link java.nio.ByteBuffer#asReadOnlyBuffer()} to create a read-only view of the buffer with an independent - * {@code position}, and calling {@code get} methods on this rather than directly on the returned {@code ByteBuffer}. - * Doing so will ensure that anyone else using the {@code ByteBuffer} will not be affected by changes to the - * {@code position}. - *

- * - * @return The data blob, which is base64-encoded when the blob is serialized. The maximum size of the data blob, - * before base64-encoding, is 1,000 KB. - */ - public ByteBuffer getData() { - return this.data; - } - - /** - * @return record id - */ - public String getRecordId() { - return this.recordId; - } - - /** - * @param recordId record id - */ - public void setRecordId(String recordId) { - this.recordId = recordId; - } - - /** - * @param recordId record id - * @return Record - */ - public Record withRecordId(String recordId) { - setRecordId(recordId); - return this; - } - - /** - * @return approximate arrival epoch - */ - public Long getApproximateArrivalEpoch() { - return this.approximateArrivalEpoch; - } - - /** - * @param approximateArrivalEpoch Long epoch - */ - public void setApproximateArrivalEpoch(Long approximateArrivalEpoch) { - this.approximateArrivalEpoch = approximateArrivalEpoch; - } - - /** - * @param approximateArrivalEpoch Long epoch - * @return Record - */ - public Record withApproximateArrivalEpoch(Long approximateArrivalEpoch) { - setApproximateArrivalEpoch(approximateArrivalEpoch); - return this; - } - - /** - * @return approximate arrival timestamp - */ - public Long getApproximateArrivalTimestamp() { - return this.approximateArrivalTimestamp; - } - - /** - * @param approximateArrivalTimestamp approximate arrival timestamp - */ - public void setApproximateArrivalTimestamp(Long approximateArrivalTimestamp) { - this.approximateArrivalTimestamp = approximateArrivalTimestamp; - } - - /** - * @param approximateArrivalTimestamp approximate arrival timestamp - * @return Record - */ - public Record withApproximateArrivalTimestamp(Long approximateArrivalTimestamp) { - setApproximateArrivalTimestamp(approximateArrivalTimestamp); - return this; - } - - /** - * @return kinesis record meta data - */ - public Map getKinesisRecordMetadata() { - return this.kinesisRecordMetadata; - } - - /** - * @param kinesisRecordMetadata kinesis record metadata - */ - public void setKinesisRecordMetadata(Map kinesisRecordMetadata) { - this.kinesisRecordMetadata = kinesisRecordMetadata; - } - - /** - * @param kinesisRecordMetadata kinesis record metadata - * @return Record - */ - public Record withKinesisRecordMetadata(Map kinesisRecordMetadata) { - setKinesisRecordMetadata(kinesisRecordMetadata); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getData() != null) - sb.append("data: ").append(getData().toString()).append(","); - if (getRecordId() != null) - sb.append("recordId: ").append(getRecordId()).append(","); - if (getApproximateArrivalEpoch() != null) - sb.append("approximateArrivalEpoch: ").append(getApproximateArrivalEpoch().toString()).append(","); - if (getApproximateArrivalTimestamp() != null) - sb.append("approximateArrivalTimestamp: ").append(getApproximateArrivalTimestamp().toString()).append(","); - if (getKinesisRecordMetadata() != null) - sb.append("kinesisRecordMetadata: ").append(getKinesisRecordMetadata().toString()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof Record == false) - return false; - Record other = (Record) obj; - if (other.getData() == null ^ this.getData() == null) - return false; - if (other.getData() != null && other.getData().equals(this.getData()) == false) - return false; - if (other.getRecordId() == null ^ this.getRecordId() == null) - return false; - if (other.getRecordId() != null && other.getRecordId().equals(this.getRecordId()) == false) - return false; - if (other.getApproximateArrivalEpoch() == null ^ this.getApproximateArrivalEpoch() == null) - return false; - if (other.getApproximateArrivalEpoch() != null && other.getApproximateArrivalEpoch().equals(this.getApproximateArrivalEpoch()) == false) - return false; - if (other.getApproximateArrivalTimestamp() == null ^ this.getApproximateArrivalTimestamp() == null) - return false; - if (other.getApproximateArrivalTimestamp() != null && other.getApproximateArrivalTimestamp().equals(this.getApproximateArrivalTimestamp()) == false) - return false; - if (other.getKinesisRecordMetadata() == null ^ this.getKinesisRecordMetadata() == null) - return false; - if (other.getKinesisRecordMetadata() != null && other.getKinesisRecordMetadata().equals(this.getKinesisRecordMetadata()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getData() == null) ? 0 : getData().hashCode()); - hashCode = prime * hashCode + ((getRecordId() == null) ? 0 : getRecordId().hashCode()); - hashCode = prime * hashCode + ((getApproximateArrivalEpoch() == null) ? 0 : getApproximateArrivalEpoch().hashCode()); - hashCode = prime * hashCode + ((getApproximateArrivalTimestamp() == null) ? 0 : getApproximateArrivalTimestamp().hashCode()); - hashCode = prime * hashCode + ((getKinesisRecordMetadata() == null) ? 0 : getKinesisRecordMetadata().hashCode()); - - return hashCode; - } - - @Override - public Record clone() { - try { - return (Record) super.clone(); - } catch (CloneNotSupportedException e) { - throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e); - } - } - - } - - /** - * default constructor - */ - public KinesisFirehoseEvent() {} - - /** - * @return invocation id - */ - public String getInvocationId() { - return this.invocationId; - } - - /** - * @param invocationId invocation id - */ - public void setInvocationId(String invocationId) { - this.invocationId = invocationId; - } - - /** - * @param invocationId invocation id - * @return KinesisFirehoseEvent - */ - public KinesisFirehoseEvent withInvocationId(String invocationId) { - setInvocationId(invocationId); - return this; - } - - /** - * @return delivery stream arn - */ - public String getDeliveryStreamArn() { - return this.deliveryStreamArn; - } - - /** - * @param deliveryStreamArn delivery stream arn - */ - public void setDeliveryStreamArn(String deliveryStreamArn) { - this.deliveryStreamArn = deliveryStreamArn; - } - - /**] - * @param deliveryStreamArn delivery stream arn - * @return KinesisFirehoseEvent - */ - public KinesisFirehoseEvent withDeliveryStreamArn(String deliveryStreamArn) { - setDeliveryStreamArn(deliveryStreamArn); - return this; - } - - /** - * @return region - */ - public String getRegion() { - return this.region; - } - - /** - * @param region aws region - */ - public void setRegion(String region) { - this.region = region; - } - - /** - * @param region aws region - * @return KinesisFirehoseEvent - */ - public KinesisFirehoseEvent withRegion(String region) { - setRegion(region); - return this; - } - - /** - * Gets the list of Kinesis event records - * - */ - public List getRecords() { - return records; - } - - /** - * Sets the list of Kinesis event records - * @param records a list of Kinesis event records - */ - public void setRecords(List records) { - this.records = records; - } - - /** - * @param records a list of Kinesis event records - * @return KinesisFirehoseEvent - */ - public KinesisFirehoseEvent withRecords(List records) { - setRecords(records); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getInvocationId() != null) - sb.append("invocationId: ").append(getInvocationId()).append(","); - if (getDeliveryStreamArn() != null) - sb.append("deliveryStreamArn: ").append(getDeliveryStreamArn()).append(","); - if (getRegion() != null) - sb.append("region: ").append(getRegion()).append(","); - if (getRecords() != null) - sb.append("records: ").append(getRecords().toString()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof KinesisFirehoseEvent == false) - return false; - KinesisFirehoseEvent other = (KinesisFirehoseEvent) obj; - if (other.getInvocationId() == null ^ this.getInvocationId() == null) - return false; - if (other.getInvocationId() != null && other.getInvocationId().equals(this.getInvocationId()) == false) - return false; - if (other.getDeliveryStreamArn() == null ^ this.getDeliveryStreamArn() == null) - return false; - if (other.getDeliveryStreamArn() != null && other.getDeliveryStreamArn().equals(this.getDeliveryStreamArn()) == false) - return false; - if (other.getRegion() == null ^ this.getRegion() == null) - return false; - if (other.getRegion() != null && other.getRegion().equals(this.getRegion()) == false) - return false; - if (other.getRecords() == null ^ this.getRecords() == null) - return false; - if (other.getRecords() != null && other.getRecords().equals(this.getRecords()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getInvocationId() == null) ? 0 : getInvocationId().hashCode()); - hashCode = prime * hashCode + ((getDeliveryStreamArn() == null) ? 0 : getDeliveryStreamArn().hashCode()); - hashCode = prime * hashCode + ((getRegion() == null) ? 0 : getRegion().hashCode()); - hashCode = prime * hashCode + ((getRecords() == null) ? 0 : getRecords().hashCode()); - return hashCode; - } - - - @Override - public KinesisFirehoseEvent clone() { - try { - return (KinesisFirehoseEvent) super.clone(); - } catch (CloneNotSupportedException e) { - throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e); - } - } -} diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/LambdaDestinationEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/LambdaDestinationEvent.java index eaa4611f..6767372b 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/LambdaDestinationEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/LambdaDestinationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -10,15 +10,18 @@ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ + package com.amazonaws.services.lambda.runtime.events; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import org.joda.time.DateTime; + +import com.fasterxml.jackson.annotation.JsonFormat; import java.io.Serializable; +import java.time.Instant; import java.util.Map; /** @@ -36,10 +39,16 @@ public class LambdaDestinationEvent implements Serializable, Cloneable { private String version; - private DateTime timestamp; + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSX", timezone = "UTC") + private Instant timestamp; + private RequestContext requestContext; + private Map requestPayload; + private Object responseContext; + private Object responsePayload; @Data @@ -47,9 +56,13 @@ public class LambdaDestinationEvent implements Serializable, Cloneable { @NoArgsConstructor @AllArgsConstructor public static class RequestContext implements Serializable, Cloneable { + private String requestId; + private String functionArn; + private String condition; + private int approximateInvokeCount; } -} +} \ No newline at end of file diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/LexEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/LexEvent.java index d3aa64cd..9bed9d70 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/LexEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/LexEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -13,12 +13,22 @@ package com.amazonaws.services.lambda.runtime.events; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + import java.io.Serializable; import java.util.Map; /** * represents a Lex event */ + +@Data +@Builder(setterPrefix = "with") +@NoArgsConstructor +@AllArgsConstructor public class LexEvent implements Serializable, Cloneable { private static final long serialVersionUID = 8660021082133163891L; @@ -40,7 +50,12 @@ public class LexEvent implements Serializable, Cloneable { /** * Represents a Lex bot */ - public class Bot implements Serializable, Cloneable { + + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor + public static class Bot implements Serializable, Cloneable { private static final long serialVersionUID = -5764739951985883358L; @@ -50,134 +65,6 @@ public class Bot implements Serializable, Cloneable { private String version; - /** - * default constructor - */ - public Bot() {} - - /** - * @return name of bot - */ - public String getName() { - return this.name; - } - - /** - * @param name name of bot - */ - public void setName(String name) { - this.name = name; - } - - /** - * @param name name of bot - * @return Bot object - */ - public Bot withName(String name) { - setName(name); - return this; - } - - /** - * @return alias of bot - */ - public String getAlias() { - return this.alias; - } - - /** - * @param alias alias of bot - */ - public void setAlias(String alias) { - this.alias = alias; - } - - public Bot withAlias(String alias) { - setAlias(alias); - return this; - } - - /** - * @return version of bot - */ - public String getVersion() { - return this.version; - } - - /** - * @param version set version of bot - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * @param version version of bot - * @return Bot - */ - public Bot withVersion(String version) { - setVersion(version); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getName() != null) - sb.append("name: ").append(getName()).append(","); - if (getAlias() != null) - sb.append("alias: ").append(getAlias()).append(","); - if (getVersion() != null) - sb.append("version: ").append(getVersion()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof Bot == false) - return false; - Bot other = (Bot) obj; - if (other.getName() == null ^ this.getName() == null) - return false; - if (other.getName() != null && other.getName().equals(this.getName()) == false) - return false; - if (other.getAlias() == null ^ this.getAlias() == null) - return false; - if (other.getAlias() != null && other.getAlias().equals(this.getAlias()) == false) - return false; - if (other.getVersion() == null ^ this.getVersion() == null) - return false; - if (other.getVersion() != null && other.getVersion().equals(this.getVersion()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); - hashCode = prime * hashCode + ((getAlias() == null) ? 0 : getAlias().hashCode()); - hashCode = prime * hashCode + ((getVersion() == null) ? 0 : getVersion().hashCode()); - - return hashCode; - } - @Override public Bot clone() { try { @@ -192,7 +79,12 @@ public Bot clone() { /** * models CurrentIntent of Lex event */ - public class CurrentIntent implements Serializable, Cloneable { + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor + + public static class CurrentIntent implements Serializable, Cloneable { private static final long serialVersionUID = 7405357938118538229L; @@ -202,138 +94,6 @@ public class CurrentIntent implements Serializable, Cloneable { private String confirmationStatus; - /** - * default constructor - */ - public CurrentIntent() {} - - /** - * @return name of bot - */ - public String getName() { - return this.name; - } - - /** - * @param name name of bot - */ - public void setName(String name) { - this.name = name; - } - - /** - * @param name name of intent - * @return Current Intent - */ - public CurrentIntent withName(String name) { - setName(name); - return this; - } - - /** - * @return map of slots - */ - public Map getSlots() { - return this.slots; - } - - /** - * @param slots map of slots - */ - public void setSlots(Map slots) { - this.slots = slots; - } - - /** - * @param slots slots in CurrentIntent - * @return CurrentIntent - */ - public CurrentIntent withSlots(Map slots) { - setSlots(slots); - return this; - } - - /** - * @return confirmation status - */ - public String getConfirmationStatus() { - return this.confirmationStatus; - } - - /** - * @param confirmationStatus confirmation status - */ - public void setConfirmationStatus(String confirmationStatus) { - this.confirmationStatus = confirmationStatus; - } - - /** - * @param confirmationStatus confirmation status - * @return CurrentIntent - */ - public CurrentIntent withConfirmationStatus(String confirmationStatus) { - setConfirmationStatus(confirmationStatus); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getName() != null) - sb.append("name: ").append(getName()).append(","); - if (getSlots() != null) - sb.append("slots: ").append(getSlots().toString()).append(","); - if (getConfirmationStatus() != null) - sb.append("confirmationStatus: ").append(getConfirmationStatus()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof CurrentIntent == false) - return false; - CurrentIntent other = (CurrentIntent) obj; - if (other.getName() == null ^ this.getName() == null) - return false; - if (other.getName() != null && other.getName().equals(this.getName()) == false) - return false; - if (other.getSlots() == null ^ this.getSlots() == null) - return false; - if (other.getSlots() != null && other.getSlots().equals(this.getSlots()) == false) - return false; - if (other.getConfirmationStatus() == null ^ this.getConfirmationStatus() == null) - return false; - if (other.getConfirmationStatus() != null && other.getConfirmationStatus().equals(this.getConfirmationStatus()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); - hashCode = prime * hashCode + ((getSlots() == null) ? 0 : getSlots().hashCode()); - hashCode = prime * hashCode + ((getConfirmationStatus() == null) ? 0 : getConfirmationStatus().hashCode()); - - return hashCode; - } - @Override public CurrentIntent clone() { try { @@ -345,259 +105,6 @@ public CurrentIntent clone() { } - /** - * default constructor - */ - public LexEvent() {} - - /** - * @return message version - */ - public String getMessageVersion() { - return this.messageVersion; - } - - /** - * @param messageVersion message version - */ - public void setMessageVersion(String messageVersion) { - this.messageVersion = messageVersion; - } - - /** - * @param messageVersion message version - * @return LexEvent - */ - public LexEvent withMessageVersion(String messageVersion) { - setMessageVersion(messageVersion); - return this; - } - - /** - * @return source of invocation - */ - public String getInvocationSource() { - return this.invocationSource; - } - - /** - * @param invocationSource source of invocation - */ - public void setInvocationSource(String invocationSource) { - this.invocationSource = invocationSource; - } - - /** - * @param invocationSource invokation source - * @return LexEvent - */ - public LexEvent withInvocationSource(String invocationSource) { - setInvocationSource(invocationSource); - return this; - } - - /** - * @return user id - */ - public String getUserId() { - return this.userId; - } - - /** - * @param userId user id - */ - public void setUserId(String userId) { - this.userId = userId; - } - - /** - * @param userId user id - * @return LexEvent - */ - public LexEvent withUserId(String userId) { - setUserId(userId); - return this; - } - - /** - * @return session attributes - */ - public Map getSessionAttributes() { - return this.sessionAttributes; - } - - /** - * @param sessionAttributes session attributes - */ - public void setSessionAttributes(Map sessionAttributes) { - this.sessionAttributes = sessionAttributes; - } - - /** - * @param sessionAttributes session attributes - * @return LexEvent - */ - public LexEvent withSessionAttributes(Map sessionAttributes) { - setSessionAttributes(sessionAttributes); - return this; - } - - /** - * @return output dialog mode - */ - public String getOutputDialogMode() { - return this.outputDialogMode; - } - - /** - * @param outputDialogMode output dialog mode - */ - public void setOutputDialogMode(String outputDialogMode) { - this.outputDialogMode = outputDialogMode; - } - - /** - * @param outputDialogMode output dialog mode - * @return LexEvent - */ - public LexEvent withOutputDialogMode(String outputDialogMode) { - setOutputDialogMode(outputDialogMode); - return this; - } - - /** - * @return current intent - */ - public CurrentIntent getCurrentIntent() { - return this.currentIntent; - } - - /** - * @param currentIntent current intent - */ - public void setCurrentIntent(CurrentIntent currentIntent) { - this.currentIntent = currentIntent; - } - - /** - * @param currentIntent current intent - * @return LexEvent - */ - public LexEvent withCurrentIntent(CurrentIntent currentIntent) { - setCurrentIntent(currentIntent); - return this; - } - - /** - * @return bot - */ - public Bot getBot() { - return this.bot; - } - - /** - * @param bot Bot object of Lex message - */ - public void setBot(Bot bot) { - this.bot = bot; - } - - /** - * @param bot Bot object of message - * @return LexEvent - */ - public LexEvent withBot(Bot bot) { - setBot(bot); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getMessageVersion() != null) - sb.append("messageVersion: ").append(getMessageVersion()).append(","); - if (getInvocationSource() != null) - sb.append("invocationSource: ").append(getInvocationSource()).append(","); - if (getUserId() != null) - sb.append("userId: ").append(getUserId()).append(","); - if (getSessionAttributes() != null) - sb.append("sessionAttributes: ").append(getSessionAttributes().toString()).append(","); - if (getOutputDialogMode() != null) - sb.append("outputDialogMode: ").append(getOutputDialogMode()).append(","); - if (getCurrentIntent() != null) - sb.append("currentIntent: ").append(getCurrentIntent().toString()).append(","); - if (getBot() != null) - sb.append("bot: ").append(getBot().toString()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof LexEvent == false) - return false; - LexEvent other = (LexEvent) obj; - if (other.getMessageVersion() == null ^ this.getMessageVersion() == null) - return false; - if (other.getMessageVersion() != null && other.getMessageVersion().equals(this.getMessageVersion()) == false) - return false; - if (other.getInvocationSource() == null ^ this.getInvocationSource() == null) - return false; - if (other.getInvocationSource() != null && other.getInvocationSource().equals(this.getInvocationSource()) == false) - return false; - if (other.getUserId() == null ^ this.getUserId() == null) - return false; - if (other.getUserId() != null && other.getUserId().equals(this.getUserId()) == false) - return false; - if (other.getSessionAttributes() == null ^ this.getSessionAttributes() == null) - return false; - if (other.getSessionAttributes() != null && other.getSessionAttributes().equals(this.getSessionAttributes()) == false) - return false; - if (other.getOutputDialogMode() == null ^ this.getOutputDialogMode() == null) - return false; - if (other.getOutputDialogMode() != null && other.getOutputDialogMode().equals(this.getOutputDialogMode()) == false) - return false; - if (other.getCurrentIntent() == null ^ this.getCurrentIntent() == null) - return false; - if (other.getCurrentIntent() != null && other.getCurrentIntent().equals(this.getCurrentIntent()) == false) - return false; - if (other.getBot() == null ^ this.getBot() == null) - return false; - if (other.getBot() != null && other.getBot().equals(this.getBot()) == false) - return false; - - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getMessageVersion() == null) ? 0 : getMessageVersion().hashCode()); - hashCode = prime * hashCode + ((getInvocationSource() == null) ? 0 : getInvocationSource().hashCode()); - hashCode = prime * hashCode + ((getUserId() == null) ? 0 : getUserId().hashCode()); - hashCode = prime * hashCode + ((getSessionAttributes() == null) ? 0 : getSessionAttributes().hashCode()); - hashCode = prime * hashCode + ((getOutputDialogMode() == null) ? 0 : getOutputDialogMode().hashCode()); - hashCode = prime * hashCode + ((getCurrentIntent() == null) ? 0 : getCurrentIntent().hashCode()); - hashCode = prime * hashCode + ((getBot() == null) ? 0 : getBot().hashCode()); - - return hashCode; - } - @Override public LexEvent clone() { try { diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/RabbitMQEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/RabbitMQEvent.java index 24fe946c..3e7caf09 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/RabbitMQEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/RabbitMQEvent.java @@ -1,3 +1,16 @@ +/* + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with + * the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + package com.amazonaws.services.lambda.runtime.events; import lombok.AllArgsConstructor; @@ -45,7 +58,7 @@ public static class BasicProperties { private int priority; private String correlationId; private String replyTo; - private int expiration; + private String expiration; private String messageId; private String timestamp; private String type; diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/S3Event.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/S3Event.java deleted file mode 100644 index a51acf7c..00000000 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/S3Event.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with - * the License. A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR - * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions - * and limitations under the License. - */ -package com.amazonaws.services.lambda.runtime.events; - -import com.amazonaws.services.lambda.runtime.events.models.s3.S3EventNotification; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * Represents and AmazonS3 event. - * - */ -public class S3Event extends S3EventNotification implements Serializable, Cloneable { - - private static final long serialVersionUID = -8094860465750962044L; - - /** - * default constructor - * (Not available in v1) - */ - public S3Event() { - super(new ArrayList()); - } - - /** - * Create a new instance of S3Event - * @param records A list of S3 event notification records - */ - public S3Event(List records) { - super(records); - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getRecords() != null) - sb.append(getRecords().toString()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof S3Event == false) - return false; - S3Event other = (S3Event) obj; - if (other.getRecords() == null ^ this.getRecords() == null) - return false; - if (other.getRecords() != null && other.getRecords().equals(this.getRecords()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getRecords() == null) ? 0 : getRecords().hashCode()); - - return hashCode; - } - - @Override - public S3Event clone() { - try { - return (S3Event) super.clone(); - } catch (CloneNotSupportedException e) { - throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e); - } - } - -} diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SNSEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SNSEvent.java index 0649581c..95f1050a 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SNSEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SNSEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -10,141 +10,56 @@ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ + package com.amazonaws.services.lambda.runtime.events; -import org.joda.time.DateTime; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonFormat; import java.io.Serializable; +import java.time.Instant; import java.util.List; import java.util.Map; /** * Represents an Amazon SNS event. */ + +@Data +@Builder(setterPrefix = "with") +@NoArgsConstructor +@AllArgsConstructor public class SNSEvent implements Serializable, Cloneable { private static final long serialVersionUID = -727529735144605167L; + @JsonProperty("Records") private List records; /** * Represents an SNS message attribute * */ + + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor public static class MessageAttribute implements Serializable, Cloneable { private static final long serialVersionUID = -5656179310535967619L; + @JsonProperty("Type") private String type; + @JsonProperty("Value") private String value; - /** - * default constructor - * (not available in v1) - */ - public MessageAttribute() {} - - /** - * Gets the attribute type - * @return type - */ - public String getType() { - return type; - } - - /** - * Sets the attribute type - * @param type A string representing the attribute type - */ - public void setType(String type) { - this.type = type; - } - - /** - * @param type type - * @return MessageAttribute - */ - public MessageAttribute withType(String type) { - setType(type); - return this; - } - - /** - * Gets the attribute value - * @return value - */ - public String getValue() { - return value; - } - - /** - * Sets the attribute value - * @param value A string containing the attribute value - */ - public void setValue(String value) { - this.value = value; - } - - /** - * @param value attriute value - * @return MessageAttribute - */ - public MessageAttribute withValue(String value) { - setValue(value); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getType() != null) - sb.append("type: ").append(getType()).append(","); - if (getValue() != null) - sb.append("value: ").append(getValue()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof MessageAttribute == false) - return false; - MessageAttribute other = (MessageAttribute) obj; - if (other.getType() == null ^ this.getType() == null) - return false; - if (other.getType() != null && other.getType().equals(this.getType()) == false) - return false; - if (other.getValue() == null ^ this.getValue() == null) - return false; - if (other.getValue() != null && other.getValue().equals(this.getValue()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode()); - hashCode = prime * hashCode + ((getValue() == null) ? 0 : getValue().hashCode()); - return hashCode; - } - @Override public MessageAttribute clone() { try { @@ -159,427 +74,49 @@ public MessageAttribute clone() { /** * Represents an SNS message */ + + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor public static class SNS implements Serializable, Cloneable { private static final long serialVersionUID = -7038894618736475592L; + @JsonProperty("MessageAttributes") private Map messageAttributes; + @JsonProperty("SigningCertUrl") private String signingCertUrl; + @JsonProperty("MessageId") private String messageId; + @JsonProperty("Message") private String message; + @JsonProperty("Subject") private String subject; + @JsonProperty("UnsubscribeUrl") private String unsubscribeUrl; + @JsonProperty("Type") private String type; + @JsonProperty("SignatureVersion") private String signatureVersion; + @JsonProperty("Signature") private String signature; - private DateTime timestamp; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSX", timezone = "UTC") + @JsonProperty("Timestamp") + private Instant timestamp; + @JsonProperty("TopicArn") private String topicArn; - /** - * default constructor - * (Not available in v1) - */ - public SNS() {} - - /** - * Gets the attributes associated with the message - * @return message attributes - */ - public Map getMessageAttributes() { - return messageAttributes; - } - - /** - * Sets the attributes associated with the message - * @param messageAttributes A map object with string and message attribute key/value pairs - */ - public void setMessageAttributes( - Map messageAttributes) { - this.messageAttributes = messageAttributes; - } - - /** - * @param messageAttributes message attributes - * @return SNS - */ - public SNS withMessageAttributes(Map messageAttributes) { - setMessageAttributes(messageAttributes); - return this; - } - - /** - * Gets the URL for the signing certificate - * @return signing certificate url - */ - public String getSigningCertUrl() { - return signingCertUrl; - } - - /** - * Sets the URL for the signing certificate - * @param signingCertUrl A string containing a URL - */ - public void setSigningCertUrl(String signingCertUrl) { - this.signingCertUrl = signingCertUrl; - } - - /** - * @param signingCertUrl signing cert url - * @return SNS - */ - public SNS withSigningCertUrl(String signingCertUrl) { - setSigningCertUrl(signingCertUrl); - return this; - } - - /** - * Gets the message id - * @return message id - */ - public String getMessageId() { - return messageId; - } - - /** - * Sets the message id - * @param messageId A string containing the message ID - */ - public void setMessageId(String messageId) { - this.messageId = messageId; - } - - /** - * @param messageId message id - * @return SNS - */ - public SNS withMessageId(String messageId) { - setMessageId(messageId); - return this; - } - - /** - * Gets the message - * @return message string - */ - public String getMessage() { - return message; - } - - /** - * Sets the message - * @param message A string containing the message body - */ - public void setMessage(String message) { - this.message = message; - } - - /** - * @param message string message - * @return SNS - */ - public SNS withMessage(String message) { - setMessage(message); - return this; - } - - /** - * Gets the subject for the message - * @return subject of message - */ - public String getSubject() { - return subject; - } - - /** - * Sets the subject for the message - * @param subject A string containing the message subject - */ - public void setSubject(String subject) { - this.subject = subject; - } - - /** - * @param subject subject of message - * @return SNS - */ - public SNS withSubject(String subject) { - setSubject(subject); - return this; - } - - /** - * Gets the message unsubscribe URL - * @return unsubscribe url - */ - public String getUnsubscribeUrl() { - return unsubscribeUrl; - } - - /** - * Sets the message unsubscribe URL - * @param unsubscribeUrl A string with the URL - */ - public void setUnsubscribeUrl(String unsubscribeUrl) { - this.unsubscribeUrl = unsubscribeUrl; - } - - /** - * @param unsubscribeUrl unsubscribe url - * @return SNS - */ - public SNS withUnsubscribeUrl(String unsubscribeUrl) { - setUnsubscribeUrl(unsubscribeUrl); - return this; - } - - /** - * Gets the message type - * @return message type - */ - public String getType() { - return type; - } - - /** - * Sets the message type - * @param type A string containing the message type - */ - public void setType(String type) { - this.type = type; - } - - /** - * @param type type - * @return SNS - */ - public SNS withType(String type) { - setType(type); - return this; - } - - /** - * Gets the signature version used to sign the message - * @return signature version - */ - public String getSignatureVersion() { - return signatureVersion; - } - - /** - * The signature version used to sign the message - * @param signatureVersion A string containing the signature version - */ - public void setSignatureVersion(String signatureVersion) { - this.signatureVersion = signatureVersion; - } - - /** - * @param signatureVersion signature version - * @return SNS - */ - public SNS withSignatureVersion(String signatureVersion) { - setSignatureVersion(signatureVersion); - return this; - } - - /** - * Gets the message signature - * @return message signature - */ - public String getSignature() { - return signature; - } - - /** - * Sets the message signature - * @param signature A string containing the message signature - */ - public void setSignature(String signature) { - this.signature = signature; - } - - /** - * @param signature signature - * @return SNS - */ - public SNS withSignature(String signature) { - setSignature(signature); - return this; - } - - /** - * Gets the message time stamp - * @return timestamp of sns message - */ - public DateTime getTimestamp() { - return timestamp; - } - - /** - * Sets the message time stamp - * @param timestamp A Date object representing the message time stamp - */ - public void setTimestamp(DateTime timestamp) { - this.timestamp = timestamp; - } - - /** - * @param timestamp timestamp - * @return SNS - */ - public SNS withTimestamp(DateTime timestamp) { - setTimestamp(timestamp); - return this; - } - - /** - * Gets the topic ARN - * @return topic arn - */ - public String getTopicArn() { - return topicArn; - } - - /** - * Sets the topic ARN - * @param topicArn A string containing the topic ARN - */ - public void setTopicArn(String topicArn) { - this.topicArn = topicArn; - } - - /** - * @param topicArn topic ARN - * @return SNS - */ - public SNS withTopicArn(String topicArn) { - setTopicArn(topicArn); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getMessageAttributes() != null) - sb.append("messageAttributes: ").append(getMessageAttributes().toString()).append(","); - if (getSigningCertUrl() != null) - sb.append("signingCertUrl: ").append(getSigningCertUrl()).append(","); - if (getMessageId() != null) - sb.append("messageId: ").append(getMessageId()).append(","); - if (getMessage() != null) - sb.append("message: ").append(getMessage()).append(","); - if (getSubject() != null) - sb.append("subject: ").append(getSubject()).append(","); - if (getUnsubscribeUrl() != null) - sb.append("unsubscribeUrl: ").append(getUnsubscribeUrl()).append(","); - if (getType() != null) - sb.append("type: ").append(getType()).append(","); - if (getSignatureVersion() != null) - sb.append("signatureVersion: ").append(getSignatureVersion()).append(","); - if (getSignature() != null) - sb.append("signature: ").append(getSignature()).append(","); - if (getTimestamp() != null) - sb.append("timestamp: ").append(getTimestamp().toString()).append(","); - if (getTopicArn() != null) - sb.append("topicArn: ").append(getTopicArn()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof SNS == false) - return false; - SNS other = (SNS) obj; - if (other.getMessageAttributes() == null ^ this.getMessageAttributes() == null) - return false; - if (other.getMessageAttributes() != null && other.getMessageAttributes().equals(this.getMessageAttributes()) == false) - return false; - if (other.getSigningCertUrl() == null ^ this.getSigningCertUrl() == null) - return false; - if (other.getSigningCertUrl() != null && other.getSigningCertUrl().equals(this.getSigningCertUrl()) == false) - return false; - if (other.getMessageId() == null ^ this.getMessageId() == null) - return false; - if (other.getMessageId() != null && other.getMessageId().equals(this.getMessageId()) == false) - return false; - if (other.getMessage() == null ^ this.getMessage() == null) - return false; - if (other.getMessage() != null && other.getMessage().equals(this.getMessage()) == false) - return false; - if (other.getSubject() == null ^ this.getSubject() == null) - return false; - if (other.getSubject() != null && other.getSubject().equals(this.getSubject()) == false) - return false; - if (other.getUnsubscribeUrl() == null ^ this.getUnsubscribeUrl() == null) - return false; - if (other.getUnsubscribeUrl() != null && other.getUnsubscribeUrl().equals(this.getUnsubscribeUrl()) == false) - return false; - if (other.getType() == null ^ this.getType() == null) - return false; - if (other.getType() != null && other.getType().equals(this.getType()) == false) - return false; - if (other.getSignatureVersion() == null ^ this.getSignatureVersion() == null) - return false; - if (other.getSignatureVersion() != null && other.getSignatureVersion().equals(this.getSignatureVersion()) == false) - return false; - if (other.getSignature() == null ^ this.getSignature() == null) - return false; - if (other.getSignature() != null && other.getSignature().equals(this.getSignature()) == false) - return false; - if (other.getTimestamp() == null ^ this.getTimestamp() == null) - return false; - if (other.getTimestamp() != null && other.getTimestamp().equals(this.getTimestamp()) == false) - return false; - if (other.getTopicArn() == null ^ this.getTopicArn() == null) - return false; - if (other.getTopicArn() != null && other.getTopicArn().equals(this.getTopicArn()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getMessageAttributes() == null) ? 0 : getMessageAttributes().hashCode()); - hashCode = prime * hashCode + ((getSigningCertUrl() == null) ? 0 : getSigningCertUrl().hashCode()); - hashCode = prime * hashCode + ((getMessageId() == null) ? 0 : getMessageId().hashCode()); - hashCode = prime * hashCode + ((getMessage() == null) ? 0 : getMessage().hashCode()); - hashCode = prime * hashCode + ((getSubject() == null) ? 0 : getSubject().hashCode()); - hashCode = prime * hashCode + ((getUnsubscribeUrl() == null) ? 0 : getUnsubscribeUrl().hashCode()); - hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode()); - hashCode = prime * hashCode + ((getSignatureVersion() == null) ? 0 : getSignatureVersion().hashCode()); - hashCode = prime * hashCode + ((getSignature() == null) ? 0 : getSignature().hashCode()); - hashCode = prime * hashCode + ((getTimestamp() == null) ? 0 : getTimestamp().hashCode()); - hashCode = prime * hashCode + ((getTopicArn() == null) ? 0 : getTopicArn().hashCode()); - return hashCode; - } - @Override public SNS clone() { try { @@ -595,188 +132,26 @@ public SNS clone() { * SNS messages to Lambda Functions. * */ + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor public static class SNSRecord implements Serializable, Cloneable { private static final long serialVersionUID = -209065548155161859L; + @JsonProperty("Sns") private SNS sns; + @JsonProperty("EventVersion") private String eventVersion; + @JsonProperty("EventSource") private String eventSource; + @JsonProperty("EventSubscriptionArn") private String eventSubscriptionArn; - /** - * default constructor - * (Not available in v1) - */ - public SNSRecord() {} - - /** - * Gets the SNS message - * @return sns body of message - */ - public SNS getSNS() { - return sns; - } - - /** - * Sets the SNS message - * @param sns An SNS object representing the SNS message - */ - public void setSns(SNS sns) { - this.sns = sns; - } - - /** - * @param sns SNS message object - * @return SNSRecord - */ - public SNSRecord withSns(SNS sns) { - setSns(sns); - return this; - } - - /** - * Gets the event version - * @return event version - */ - public String getEventVersion() { - return eventVersion; - } - - /** - * Sets the event version - * @param eventVersion A string containing the event version - */ - public void setEventVersion(String eventVersion) { - this.eventVersion = eventVersion; - } - - /** - * @param eventVersion event version - * @return SNSRecord - */ - public SNSRecord withEventVersion(String eventVersion) { - setEventVersion(eventVersion); - return this; - } - - /** - * Gets the event source - * @return event source - */ - public String getEventSource() { - return eventSource; - } - - /** - * Sets the event source - * @param eventSource A string containing the event source - */ - public void setEventSource(String eventSource) { - this.eventSource = eventSource; - } - - /** - * @param eventSource event source - * @return SNSRecord - */ - public SNSRecord withEventSource(String eventSource) { - setEventSource(eventSource); - return this; - } - - /** - * Gets the event subscription ARN - * @return event subscription arn - */ - public String getEventSubscriptionArn() { - return eventSubscriptionArn; - } - - /** - * Sets the event subscription ARN - * @param eventSubscriptionArn A string containing the event subscription ARN - */ - public void setEventSubscriptionArn(String eventSubscriptionArn) { - this.eventSubscriptionArn = eventSubscriptionArn; - } - - /** - * @param eventSubscriptionArn event subscription arn - * @return SNSRecord - */ - public SNSRecord withEventSubscriptionArn(String eventSubscriptionArn) { - setEventSubscriptionArn(eventSubscriptionArn); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getSNS() != null) - sb.append("sns: ").append(getSNS().toString()).append(","); - if (getEventVersion() != null) - sb.append("eventVersion: ").append(getEventVersion()).append(","); - if (getEventSource() != null) - sb.append("eventSource: ").append(getEventSource()).append(","); - if (getEventSubscriptionArn() != null) - sb.append("eventSubscriptionArn: ").append(getEventSubscriptionArn()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof SNSRecord == false) - return false; - SNSRecord other = (SNSRecord) obj; - if (other.getSNS() == null ^ this.getSNS() == null) - return false; - if (other.getSNS() != null && other.getSNS().equals(this.getSNS()) == false) - return false; - if (other.getEventVersion() == null ^ this.getEventVersion() == null) - return false; - if (other.getEventVersion() != null && other.getEventVersion().equals(this.getEventVersion()) == false) - return false; - if (other.getEventSource() == null ^ this.getEventSource() == null) - return false; - if (other.getEventSource() != null && other.getEventSource().equals(this.getEventSource()) == false) - return false; - if (other.getEventSubscriptionArn() == null ^ this.getEventSubscriptionArn() == null) - return false; - if (other.getEventSubscriptionArn() != null && other.getEventSubscriptionArn().equals(this.getEventSubscriptionArn()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getSNS() == null) ? 0 : getSNS().hashCode()); - hashCode = prime * hashCode + ((getEventVersion() == null) ? 0 : getEventVersion().hashCode()); - hashCode = prime * hashCode + ((getEventSource() == null) ? 0 : getEventSource().hashCode()); - hashCode = prime * hashCode + ((getEventSubscriptionArn() == null) ? 0 : getEventSubscriptionArn().hashCode()); - return hashCode; - } - @Override public SNSRecord clone() { try { @@ -788,80 +163,6 @@ public SNSRecord clone() { } - /** - * default constructor - * (Not available in v1) - */ - public SNSEvent() {} - - /** - * Gets the list of SNS records - * @return List of records - */ - public List getRecords() { - return records; - } - - /** - * Sets a list of SNS records - * @param records A list of SNS record objects - */ - public void setRecords(List records) { - this.records = records; - } - - /** - * @param records a List of SNSRecords - * @return SNSEvent - */ - public SNSEvent withRecords(List records) { - setRecords(records); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getRecords() != null) - sb.append(getRecords()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof SNSEvent == false) - return false; - SNSEvent other = (SNSEvent) obj; - if (other.getRecords() == null ^ this.getRecords() == null) - return false; - if (other.getRecords() != null && other.getRecords().equals(this.getRecords()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getRecords() == null) ? 0 : getRecords().hashCode()); - return hashCode; - } - @Override public SNSEvent clone() { try { @@ -870,5 +171,4 @@ public SNSEvent clone() { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e); } } - } \ No newline at end of file diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SQSBatchResponse.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SQSBatchResponse.java index c1f728f1..6745ba14 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SQSBatchResponse.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SQSBatchResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SQSEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SQSEvent.java index 5b360834..b02c11d8 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SQSEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SQSEvent.java @@ -1,9 +1,25 @@ /* - * Copyright 2012-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with + * the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ package com.amazonaws.services.lambda.runtime.events; +import lombok.Data; +import lombok.Builder; +import lombok.NoArgsConstructor; +import lombok.AllArgsConstructor; + +import com.fasterxml.jackson.annotation.JsonProperty; + import java.io.Serializable; import java.nio.ByteBuffer; import java.util.List; @@ -12,182 +28,50 @@ /** * Represents an Amazon SQS event. */ + +@Data +@Builder(setterPrefix = "with") +@NoArgsConstructor +@AllArgsConstructor public class SQSEvent implements Serializable, Cloneable { private static final long serialVersionUID = -5663700178408796225L; + @JsonProperty("Records") private List records; + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor public static class MessageAttribute implements Serializable, Cloneable { private static final long serialVersionUID = -1602746537669100978L; - private String stringValue; - - private ByteBuffer binaryValue; - - private List stringListValues; - - private List binaryListValues; - - private String dataType; - /** - * Default constructor + * The value of message attribute of type String or type Number */ - public MessageAttribute() {} - - /** - * Gets the value of message attribute of type String or type Number - * @return stringValue - */ - public String getStringValue() { - return stringValue; - } - - /** - * Sets the value of message attribute of type String or type Number - * @param stringValue A string representing the value of attribute of type String or type Number - */ - public void setStringValue(String stringValue) { - this.stringValue = stringValue; - } - - /** - * Gets the value of message attribute of type Binary - * @return binaryValue - */ - public ByteBuffer getBinaryValue() { - return binaryValue; - } - - /** - * Sets the value of message attribute of type Binary - * @param binaryValue A string representing the value of attribute of type Binary - */ - public void setBinaryValue(ByteBuffer binaryValue) { - this.binaryValue = binaryValue; - } - - /** - * Gets the list of String values of message attribute - * @return stringListValues - */ - public List getStringListValues() { - return stringListValues; - } - - /** - * Sets the list of String values of message attribute - * @param stringListValues A list of String representing the value of attribute - */ - public void setStringListValues(List stringListValues) { - this.stringListValues = stringListValues; - } - - /** - * Gets the list of Binary values of message attribute - * @return binaryListValues - */ - public List getBinaryListValues() { - return binaryListValues; - } + private String stringValue; /** - * Sets the list of Binary values of message attribute - * @param binaryListValues A list of Binary representing the value of attribute + * The value of message attribute of type Binary */ - public void setBinaryListValues(List binaryListValues) { - this.binaryListValues = binaryListValues; - } + private ByteBuffer binaryValue; /** - * Gets the dataType of message attribute - * @return dataType + * The list of String values of message attribute */ - public String getDataType() { - return dataType; - } + private List stringListValues; /** - * Sets the dataType of message attribute - * @param dataType A string representing the data type of attribute + * The list of Binary values of message attribute */ - public void setDataType(String dataType) { - this.dataType = dataType; - } + private List binaryListValues; /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() + * The dataType of message attribute */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getStringValue() != null) - sb.append("stringValue: ").append(getStringValue()).append(","); - if (getBinaryValue() != null) - sb.append("binaryValue: ").append(getBinaryValue().toString()).append(","); - if (getStringListValues() != null) - sb.append("stringListValues: ").append(getStringListValues()).append(","); - if (getBinaryListValues() != null) - sb.append("binaryListValues: ").append(getBinaryListValues()).append(","); - if (getDataType() != null) - sb.append("dataType: ").append(getDataType()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (obj instanceof MessageAttribute == false) - return false; - MessageAttribute other = (MessageAttribute) obj; - if (other.getStringValue() == null ^ this.getStringValue() == null) - return false; - if (other.getStringValue() != null && other.getStringValue().equals(this.getStringValue()) == false) - return false; - if (other.getBinaryValue() == null ^ this.getBinaryValue() == null) - return false; - if (other.getBinaryValue() != null && other.getBinaryValue().equals(this.getBinaryValue()) == false) - return false; - if (other.getStringListValues() == null ^ this.getStringListValues() == null) - return false; - if (other.getStringListValues() != null - && other.getStringListValues().equals(this.getStringListValues()) == false) - return false; - if (other.getBinaryListValues() == null ^ this.getBinaryListValues() == null) - return false; - if (other.getBinaryListValues() != null - && other.getBinaryListValues().equals(this.getBinaryListValues()) == false) - return false; - if (other.getDataType() == null ^ this.getDataType() == null) - return false; - if (other.getDataType() != null && other.getDataType().equals(this.getDataType()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getStringValue() == null) ? 0 : getStringValue().hashCode()); - hashCode = prime * hashCode + ((getBinaryValue() == null) ? 0 : getBinaryValue().hashCode()); - hashCode = prime * hashCode + ((getStringListValues() == null) ? 0 : getStringListValues().hashCode()); - hashCode = prime * hashCode + ((getBinaryListValues() == null) ? 0 : getBinaryListValues().hashCode()); - hashCode = prime * hashCode + ((getDataType() == null) ? 0 : getDataType().hashCode()); - return hashCode; - } + private String dataType; @Override public MessageAttribute clone() { @@ -200,6 +84,10 @@ public MessageAttribute clone() { } + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor public static class SQSMessage implements Serializable, Cloneable { private static final long serialVersionUID = -2300083946005987098L; @@ -214,6 +102,7 @@ public static class SQSMessage implements Serializable, Cloneable { private String md5OfMessageAttributes; + @JsonProperty("eventSourceARN") private String eventSourceArn; private String eventSource; @@ -224,260 +113,6 @@ public static class SQSMessage implements Serializable, Cloneable { private Map messageAttributes; - /** - * Default constructor - */ - public SQSMessage() {} - - /** - * Gets the message id - * @return messageId - */ - public String getMessageId() { return messageId; } - - /** - * Sets the message id - * @param messageId - **/ - public void setMessageId(String messageId) { - this.messageId = messageId; - } - - /** - * Gets the receipt handle - * @return receiptHandle - */ - public String getReceiptHandle() { return receiptHandle; } - - /** - * Sets the receipt handle - * @param receiptHandle - **/ - public void setReceiptHandle(String receiptHandle) { - this.receiptHandle = receiptHandle; - } - - /** - * Gets the body - * @return body - */ - public String getBody() { return body; } - - /** - * Sets the body - * @param body - **/ - public void setBody(String body) { - this.body = body; - } - - /** - * Gets the md5 of body - * @return md5OfBody - */ - public String getMd5OfBody() { return md5OfBody; } - - /** - * Sets the md5 of body - * @param md5OfBody - **/ - public void setMd5OfBody(String md5OfBody) { - this.md5OfBody = md5OfBody; - } - - /** - * Gets the md5 of message attributes - * @return md5OfMessageAttributes - */ - public String getMd5OfMessageAttributes() { return md5OfMessageAttributes; } - - /** - * Sets the md5 of message attributes - * @param md5OfMessageAttributes - **/ - public void setMd5OfMessageAttributes(String md5OfMessageAttributes) { - this.md5OfMessageAttributes = md5OfMessageAttributes; - } - - /** - * Gets the Event Source ARN - * @return eventSourceArn - */ - public String getEventSourceArn() { return eventSourceArn; } - - /** - * Sets the Event Source ARN - * @param eventSourceArn - **/ - public void setEventSourceArn(String eventSourceArn) { - this.eventSourceArn = eventSourceArn; - } - - /** - * Gets the Event Source - * @return eventSource - */ - public String getEventSource() { return eventSource; } - - /** - * Sets the Event Source - * @param eventSource - **/ - public void setEventSource(String eventSource) { - this.eventSource = eventSource; - } - - /** - * Gets the AWS Region - * @return awsRegion - */ - public String getAwsRegion() { return awsRegion; } - - /** - * Sets the AWS Region - * @param awsRegion - **/ - public void setAwsRegion(String awsRegion) { - this.awsRegion = awsRegion; - } - - /** - * Gets the attributes associated with the queue - * @return attributes - */ - public Map getAttributes() { return attributes; } - - /** - * Sets the queue attributes associated with the queue - * @param attributes - **/ - public void setAttributes(Map attributes) { - this.attributes = attributes; - } - - /** - * Gets the attributes associated with the message - * @return message attributes - */ - public Map getMessageAttributes() { - return messageAttributes; - } - - /** - * Sets the attributes associated with the message - * @param messageAttributes A map object with string and message attribute key/value pairs - */ - public void setMessageAttributes(Map messageAttributes) { - this.messageAttributes = messageAttributes; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getMessageId() != null) - sb.append("messageId: ").append(getMessageId()).append(","); - if (getReceiptHandle() != null) - sb.append("receiptHandle: ").append(getReceiptHandle()).append(","); - if (getEventSourceArn() != null) - sb.append("eventSourceARN: ").append(getEventSourceArn()).append(","); - if (getEventSource() != null) - sb.append("eventSource: ").append(getEventSource()).append(","); - if (getAwsRegion() != null) - sb.append("awsRegion: ").append(getAwsRegion()).append(","); - if (getBody() != null) - sb.append("body: ").append(getBody()).append(","); - if (getMd5OfBody() != null) - sb.append("md5OfBody: ").append(getMd5OfBody()).append(","); - if (getMd5OfMessageAttributes() != null) - sb.append("md5OfMessageAttributes: ").append(getMd5OfMessageAttributes()).append(","); - if (getAttributes() != null) - sb.append("attributes: ").append(getAttributes().toString()).append(","); - if (getMessageAttributes() != null) - sb.append("messageAttributes: ").append(getMessageAttributes().toString()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (obj instanceof SQSMessage == false) - return false; - SQSMessage other = (SQSMessage) obj; - if (other.getMessageId() == null ^ this.getMessageId() == null) - return false; - if (other.getMessageId() != null && other.getMessageId().equals(this.getMessageId()) == false) - return false; - if (other.getReceiptHandle() == null ^ this.getReceiptHandle() == null) - return false; - if (other.getReceiptHandle() != null && other.getReceiptHandle().equals(this.getReceiptHandle()) == false) - return false; - if (other.getEventSourceArn() == null ^ this.getEventSourceArn() == null) - return false; - if (other.getEventSourceArn() != null && other.getEventSourceArn().equals(this.getEventSourceArn()) == false) - return false; - if (other.getEventSource() == null ^ this.getEventSource() == null) - return false; - if (other.getEventSource() != null && other.getEventSource().equals(this.getEventSource()) == false) - return false; - if (other.getAwsRegion() == null ^ this.getAwsRegion() == null) - return false; - if (other.getAwsRegion() != null && other.getAwsRegion().equals(this.getAwsRegion()) == false) - return false; - if (other.getBody() == null ^ this.getBody() == null) - return false; - if (other.getBody() != null && other.getBody().equals(this.getBody()) == false) - return false; - if (other.getMd5OfBody() == null ^ this.getMd5OfBody() == null) - return false; - if (other.getMd5OfBody() != null && other.getMd5OfBody().equals(this.getMd5OfBody()) == false) - return false; - if (other.getMd5OfMessageAttributes() == null ^ this.getMd5OfMessageAttributes() == null) - return false; - if (other.getMd5OfMessageAttributes() != null - && other.getMd5OfMessageAttributes().equals(this.getMd5OfMessageAttributes()) == false) - return false; - if (other.getAttributes() == null ^ this.getAttributes() == null) - return false; - if (other.getAttributes() != null && other.getAttributes().equals(this.getAttributes()) == false) - return false; - if (other.getMessageAttributes() == null ^ this.getMessageAttributes() == null) - return false; - if (other.getMessageAttributes() != null - && other.getMessageAttributes().equals(this.getMessageAttributes()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getMessageAttributes() == null) ? 0 : getMessageAttributes().hashCode()); - hashCode = prime * hashCode + ((getMessageId() == null) ? 0 : getMessageId().hashCode()); - hashCode = prime * hashCode + ((getReceiptHandle() == null) ? 0 : getReceiptHandle().hashCode()); - hashCode = prime * hashCode + ((getEventSourceArn() == null) ? 0 : getEventSourceArn().hashCode()); - hashCode = prime * hashCode + ((getEventSource() == null) ? 0 : getEventSource().hashCode()); - hashCode = prime * hashCode + ((getAwsRegion() == null) ? 0 : getAwsRegion().hashCode()); - hashCode = prime * hashCode + ((getBody() == null) ? 0 : getBody().hashCode()); - hashCode = prime * hashCode + ((getMd5OfBody() == null) ? 0 : getMd5OfBody().hashCode()); - hashCode = prime * hashCode + ((getMd5OfMessageAttributes() == null) ? 0 : getMd5OfMessageAttributes().hashCode()); - hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode()); - return hashCode; - } - @Override public SQSMessage clone() { try { @@ -489,68 +124,6 @@ public SQSMessage clone() { } - /** - * Default constructor - */ - public SQSEvent() {} - - /** - * Gets the list of SQS messages - * @return List of messages - */ - public List getRecords() { return records; } - - /** - * Sets a list of SQS messages - * @param records A list of SQS message objects - */ - public void setRecords(List records) { - this.records = records; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getRecords() != null) - sb.append("Records: ").append(getRecords()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (!(obj instanceof SQSEvent)) - return false; - SQSEvent other = (SQSEvent) obj; - if (other.getRecords() == null ^ this.getRecords() == null) - return false; - if (other.getRecords() != null && other.getRecords().equals(this.getRecords()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getRecords() == null) ? 0 : getRecords().hashCode()); - - return hashCode; - } - @Override public SQSEvent clone() { try { diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ScheduledEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ScheduledEvent.java index 5908c39c..5c784dfc 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ScheduledEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/ScheduledEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -13,15 +13,27 @@ package com.amazonaws.services.lambda.runtime.events; -import org.joda.time.DateTime; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonFormat; import java.io.Serializable; +import java.time.Instant; import java.util.List; import java.util.Map; /** * represents a scheduled event */ + +@Data +@Builder(setterPrefix = "with") +@NoArgsConstructor +@AllArgsConstructor public class ScheduledEvent implements Serializable, Cloneable { private static final long serialVersionUID = -5810383198587331146L; @@ -30,299 +42,26 @@ public class ScheduledEvent implements Serializable, Cloneable { private String region; + /** + * The details of the events (usually left blank) + */ private Map detail; + /** + * The details type - see cloud watch events for more info + */ + @JsonProperty("detail-type") private String detailType; private String source; private String id; - private DateTime time; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSX", timezone = "UTC") + private Instant time; private List resources; - /** - * default constructor - */ - public ScheduledEvent() {} - - /** - * @return the account id - */ - public String getAccount() { - return account; - } - - /** - * @param account the account id - */ - public void setAccount(String account) { - this.account = account; - } - - /** - * @param account account id - * @return ScheduledEvent - */ - public ScheduledEvent withAccount(String account) { - setAccount(account); - return this; - } - - /** - * @return the aws region - */ - public String getRegion() { - return region; - } - - /** - * @param region the aws region - */ - public void setRegion(String region) { - this.region = region; - } - - /** - * @param region aws region - * @return ScheduledEvent - */ - public ScheduledEvent withRegion(String region) { - setRegion(region); - return this; - } - - /** - * @return The details of the events (usually left blank) - */ - public Map getDetail() { - return detail; - } - - /** - * @param detail The details of the events (usually left blank) - */ - public void setDetail(Map detail) { - this.detail = detail; - } - - /** - * @param detail details of the events (usually left blank) - * @return ScheduledEvent - */ - public ScheduledEvent withDetail(Map detail) { - setDetail(detail); - return this; - } - - /** - * @return The details type - see cloud watch events for more info - */ - public String getDetailType() { - return detailType; - } - - /** - * @param detailType The details type - see cloud watch events for more info - */ - public void setDetailType(String detailType) { - this.detailType = detailType; - } - - /** - * @param detailType The details type - see cloud watch events for more info - * @return ScheduledEvent - */ - public ScheduledEvent withDetailType(String detailType) { - setDetailType(detailType); - return this; - } - - /** - * @return the soruce of the event - */ - public String getSource() { - return source; - } - - /** - * @param soruce the soruce of the event - */ - public void setSource(String soruce) { - this.source = soruce; - } - - /** - * @param source source of the event - * @return ScheduledEvent - */ - public ScheduledEvent withSource(String source) { - setSource(source); - return this; - } - - /** - * @return the timestamp for when the event is scheduled - */ - public DateTime getTime() { - return this.time; - } - - /** - * @param time the timestamp for when the event is scheduled - */ - public void setTime(DateTime time) { - this.time = time; - } - - /** - * @param time the timestamp for when the event is scheduled - * @return ScheduledEvent - */ - public ScheduledEvent withTime(DateTime time) { - setTime(time); - return this; - } - - /** - * @return the id of the event - */ - public String getId() { - return id; - } - - /** - * @param id the id of the event - */ - public void setId(String id) { - this.id = id; - } - - /** - * @param id id of event - * @return ScheduledEvent - */ - public ScheduledEvent withId(String id) { - setId(id); - return this; - } - - /** - * @return the resources used by event - */ - public List getResources() { - return this.resources; - } - - /** - * @param resources the resources used by event - */ - public void setResources(List resources) { - this.resources = resources; - } - - /** - * @param resources list of resource names - * @return Scheduled event object - */ - public ScheduledEvent withResources(List resources) { - setResources(resources); - return this; - } - - /** - * Returns a string representation of this object; useful for testing and debugging. - * - * @return A string representation of this object. - * - * @see Object#toString() - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - if (getAccount() != null) - sb.append("account: ").append(getAccount()).append(","); - if (getRegion() != null) - sb.append("region: ").append(getRegion()).append(","); - if (getDetail() != null) - sb.append("detail: ").append(getDetail().toString()).append(","); - if (getDetailType() != null) - sb.append("detailType: ").append(getDetailType()).append(","); - if (getSource() != null) - sb.append("source: ").append(getSource()).append(","); - if (getId() != null) - sb.append("id: ").append(getId()).append(","); - if (getTime() != null) - sb.append("time: ").append(getTime().toString()).append(","); - if (getResources() != null) - sb.append("resources: ").append(getResources()); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - - if (obj instanceof ScheduledEvent == false) - return false; - ScheduledEvent other = (ScheduledEvent) obj; - if (other.getAccount() == null ^ this.getAccount() == null) - return false; - if (other.getAccount() != null && other.getAccount().equals(this.getAccount()) == false) - return false; - if (other.getRegion() == null ^ this.getRegion() == null) - return false; - if (other.getRegion() != null && other.getRegion().equals(this.getRegion()) == false) - return false; - if (other.getDetail() == null ^ this.getDetail() == null) - return false; - if (other.getDetail() != null && other.getDetail().equals(this.getDetail()) == false) - return false; - if (other.getDetailType() == null ^ this.getDetailType() == null) - return false; - if (other.getDetailType() != null && other.getDetailType().equals(this.getDetailType()) == false) - return false; - if (other.getSource() == null ^ this.getSource() == null) - return false; - if (other.getSource() != null && other.getSource().equals(this.getSource()) == false) - return false; - if (other.getId() == null ^ this.getId() == null) - return false; - if (other.getId() != null && other.getId().equals(this.getId()) == false) - return false; - if (other.getTime() == null ^ this.getTime() == null) - return false; - if (other.getTime() != null && other.getTime().equals(this.getTime()) == false) - return false; - if (other.getResources() == null ^ this.getResources() == null) - return false; - if (other.getResources() != null && other.getResources().equals(this.getResources()) == false) - return false; - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int hashCode = 1; - - hashCode = prime * hashCode + ((getAccount() == null) ? 0 : getAccount().hashCode()); - hashCode = prime * hashCode + ((getRegion() == null) ? 0 : getRegion().hashCode()); - hashCode = prime * hashCode + ((getDetail() == null) ? 0 : getDetail().hashCode()); - hashCode = prime * hashCode + ((getDetailType() == null) ? 0 : getDetailType().hashCode()); - hashCode = prime * hashCode + ((getSource() == null) ? 0 : getSource().hashCode()); - hashCode = prime * hashCode + ((getId() == null) ? 0 : getId().hashCode()); - hashCode = prime * hashCode + ((getTime() == null) ? 0 : getTime().hashCode()); - hashCode = prime * hashCode + ((getResources() == null) ? 0 : getResources().hashCode()); - return hashCode; - } - @Override public ScheduledEvent clone() { try { diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SecretsManagerRotationEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SecretsManagerRotationEvent.java index 4634c515..7af4f2ef 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SecretsManagerRotationEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SecretsManagerRotationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -18,13 +18,7 @@ import lombok.Data; import lombok.NoArgsConstructor; -/** - * Class to represent the events which are sent during a Secrets Manager rotation process. - * - * @see Rotating secrets lambda function overview - * - * @author msailes - */ +import com.fasterxml.jackson.annotation.JsonProperty; @Data @Builder(setterPrefix = "with") @@ -32,8 +26,12 @@ @AllArgsConstructor public class SecretsManagerRotationEvent { + @JsonProperty("Step") private String step; + + @JsonProperty("SecretId") private String secretId; - private String clientRequestToken; -} + @JsonProperty("ClientRequestToken") + private String clientRequestToken; +} \ No newline at end of file diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SimpleIAMPolicyResponse.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SimpleIAMPolicyResponse.java index 030a1468..18d85688 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SimpleIAMPolicyResponse.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/SimpleIAMPolicyResponse.java @@ -1,3 +1,16 @@ +/* + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with + * the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + package com.amazonaws.services.lambda.runtime.events; import lombok.AllArgsConstructor; @@ -5,6 +18,8 @@ import lombok.Data; import lombok.NoArgsConstructor; +import com.fasterxml.jackson.annotation.JsonProperty; + import java.util.Map; /** @@ -18,6 +33,7 @@ @AllArgsConstructor public class SimpleIAMPolicyResponse { + @JsonProperty("isAuthorized") private boolean isAuthorized; private Map context; } \ No newline at end of file diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/StreamsEventResponse.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/StreamsEventResponse.java index 9d2990f9..f34f5a30 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/StreamsEventResponse.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/StreamsEventResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -13,6 +13,8 @@ package com.amazonaws.services.lambda.runtime.events; +import com.amazonaws.services.lambda.runtime.events.dynamodb.DynamodbEvent; +import com.amazonaws.services.lambda.runtime.events.kinesis.KinesisEvent; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/models/TimeWindow.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/TimeWindow.java similarity index 71% rename from aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/models/TimeWindow.java rename to aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/TimeWindow.java index 77d0452f..8b35727d 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/models/TimeWindow.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/TimeWindow.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -11,29 +11,18 @@ * and limitations under the License. */ -package com.amazonaws.services.lambda.runtime.events.models; +package com.amazonaws.services.lambda.runtime.events; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -/** - * Represents a time window. - */ @Data @Builder(setterPrefix = "with") @NoArgsConstructor @AllArgsConstructor public class TimeWindow { - - /** - * Window start instant represented as ISO-8601 string. - */ private String start; - - /** - * Window end instant represented as ISO-8601 string. - */ private String end; -} +} \ No newline at end of file diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/TimeWindowEventResponse.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/TimeWindowEventResponse.java index 8d144075..860b8bc7 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/TimeWindowEventResponse.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/TimeWindowEventResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -13,6 +13,8 @@ package com.amazonaws.services.lambda.runtime.events; +import com.amazonaws.services.lambda.runtime.events.dynamodb.DynamodbTimeWindowEvent; +import com.amazonaws.services.lambda.runtime.events.kinesis.KinesisTimeWindowEvent; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayCustomAuthorizerEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayCustomAuthorizerEvent.java similarity index 70% rename from aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayCustomAuthorizerEvent.java rename to aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayCustomAuthorizerEvent.java index 72883319..a8a5eb26 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayCustomAuthorizerEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayCustomAuthorizerEvent.java @@ -1,4 +1,17 @@ -package com.amazonaws.services.lambda.runtime.events; +/* + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with + * the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +package com.amazonaws.services.lambda.runtime.events.apigateway; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayProxyRequestEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayProxyRequestEvent.java new file mode 100644 index 00000000..61c3b3c2 --- /dev/null +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayProxyRequestEvent.java @@ -0,0 +1,154 @@ +/* + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with + * the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +package com.amazonaws.services.lambda.runtime.events.apigateway; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** + * Class that represents an APIGatewayProxyRequestEvent + */ + +@Data +@Builder(setterPrefix = "with") +@NoArgsConstructor +@AllArgsConstructor +public class APIGatewayProxyRequestEvent implements Serializable, Cloneable { + + private static final long serialVersionUID = 4189228800688527467L; + + 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 ProxyRequestContext requestContext; + + private String body; + + private Boolean isBase64Encoded; + + /** + * class that represents proxy request context + */ + + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor + public static class ProxyRequestContext implements Serializable, Cloneable { + + private static final long serialVersionUID = 8783459961042799774L; + + private String accountId; + + private String stage; + + private String resourceId; + + private String requestId; + + private RequestIdentity identity; + + private String resourcePath; + + private String httpMethod; + + private String apiId; + + private String path; + + private Map authorizer; + + @Override + public ProxyRequestContext clone() { + try { + return (ProxyRequestContext) super.clone(); + } catch (CloneNotSupportedException e) { + throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e); + } + } + + } + + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor + public static class RequestIdentity implements Serializable, Cloneable { + + private static final long serialVersionUID = -5283829736983640346L; + + 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; + + @Override + public RequestIdentity clone() { + try { + return (RequestIdentity) super.clone(); + } catch (CloneNotSupportedException e) { + throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e); + } + } + } + + @Override + public APIGatewayProxyRequestEvent clone() { + try { + return (APIGatewayProxyRequestEvent) super.clone(); + } catch (CloneNotSupportedException e) { + throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e); + } + } +} diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayProxyResponseEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayProxyResponseEvent.java new file mode 100644 index 00000000..c0b6de15 --- /dev/null +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayProxyResponseEvent.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with + * the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +package com.amazonaws.services.lambda.runtime.events.apigateway; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Map; + +/** + * Class that represents an APIGatewayProxyResponseEvent object + */ + +@Data +@Builder(setterPrefix = "with") +@NoArgsConstructor +@AllArgsConstructor +public class APIGatewayProxyResponseEvent implements Serializable, Cloneable { + + private static final long serialVersionUID = 2263167344670024172L; + + private Integer statusCode; + + private Map headers; + + private String body; + + private Boolean isBase64Encoded; + + @Override + public APIGatewayProxyResponseEvent clone() { + try { + return (APIGatewayProxyResponseEvent) super.clone(); + } catch (CloneNotSupportedException e) { + throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e); + } + } + +} diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayV2CustomAuthorizerEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayV2CustomAuthorizerEvent.java new file mode 100644 index 00000000..90c24175 --- /dev/null +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayV2CustomAuthorizerEvent.java @@ -0,0 +1,125 @@ +/* + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with + * the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +package com.amazonaws.services.lambda.runtime.events.apigateway; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +import java.time.Instant; +import java.util.List; +import java.util.Map; + +/** + * The V2 API Gateway customer authorizer event object as described - https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html + * + */ + +@Data +@Builder(setterPrefix = "with") +@NoArgsConstructor +@AllArgsConstructor +public class APIGatewayV2CustomAuthorizerEvent { + + private String version; + private String type; + private String routeArn; + private List identitySource; + private String routeKey; + private String rawPath; + private String rawQueryString; + private List cookies; + private Map headers; + private Map queryStringParameters; + private RequestContext requestContext; + private Map pathParameters; + private Map stageVariables; + + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor + public static class RequestContext { + + private String accountId; + private String apiId; + private Authentication authentication; + private String domainName; + private String domainPrefix; + private Http http; + private String requestId; + private String routeKey; + private String stage; + private String time; + private long timeEpoch; + + @JsonIgnore + public Instant getEpochTime() { + return Instant.ofEpochMilli(timeEpoch); + } + + @JsonIgnore + public Instant getDateTime() { + return Instant.parse(time); + } + + @AllArgsConstructor + @Builder(setterPrefix = "with") + @Data + @NoArgsConstructor + public static class Authentication { + + private APIGatewayV2HTTPEvent.RequestContext.Authentication.ClientCert clientCert; + + @AllArgsConstructor + @Builder(setterPrefix = "with") + @Data + @NoArgsConstructor + public static class ClientCert { + + private String clientCertPem; + private String issuerDN; + private String serialNumber; + private String subjectDN; + private APIGatewayV2HTTPEvent.RequestContext.Authentication.ClientCert.Validity validity; + + @AllArgsConstructor + @Builder(setterPrefix = "with") + @Data + @NoArgsConstructor + public static class Validity { + + private String notAfter; + private String notBefore; + } + } + } + + @AllArgsConstructor + @Builder(setterPrefix = "with") + @Data + @NoArgsConstructor + public static class Http { + + private String method; + private String path; + private String protocol; + private String sourceIp; + private String userAgent; + } + } +} \ No newline at end of file diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2HTTPEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayV2HTTPEvent.java similarity index 74% rename from aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2HTTPEvent.java rename to aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayV2HTTPEvent.java index 3393822e..49bee30e 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2HTTPEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayV2HTTPEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -11,23 +11,27 @@ * and limitations under the License. */ -package com.amazonaws.services.lambda.runtime.events; +package com.amazonaws.services.lambda.runtime.events.apigateway; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import com.fasterxml.jackson.annotation.JsonProperty; + import java.util.List; import java.util.Map; + +/** + * API Gateway v2 event: https://docs.aws.amazon.com/lambda/latest/dg/services-apigateway.html + */ + @AllArgsConstructor @Builder(setterPrefix = "with") @Data @NoArgsConstructor -/** - * API Gateway v2 event: https://docs.aws.amazon.com/lambda/latest/dg/services-apigateway.html - */ public class APIGatewayV2HTTPEvent { private String version; private String routeKey; @@ -39,6 +43,7 @@ public class APIGatewayV2HTTPEvent { private Map pathParameters; private Map stageVariables; private String body; + @JsonProperty("isBase64Encoded") private boolean isBase64Encoded; private RequestContext requestContext; @@ -51,6 +56,7 @@ public static class RequestContext { private String accountId; private String stage; private String apiId; + private Authentication authentication; private String domainName; private String domainPrefix; private String time; @@ -59,6 +65,38 @@ public static class RequestContext { private Authorizer authorizer; private String requestId; + @AllArgsConstructor + @Builder(setterPrefix = "with") + @Data + @NoArgsConstructor + public static class Authentication { + + private ClientCert clientCert; + + @AllArgsConstructor + @Builder(setterPrefix = "with") + @Data + @NoArgsConstructor + public static class ClientCert { + + private String clientCertPem; + private String issuerDN; + private String serialNumber; + private String subjectDN; + private Validity validity; + + @AllArgsConstructor + @Builder(setterPrefix = "with") + @Data + @NoArgsConstructor + public static class Validity { + + private String notAfter; + private String notBefore; + } + } + } + @AllArgsConstructor @Builder(setterPrefix = "with") @Data diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2HTTPResponse.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayV2HTTPResponse.java similarity index 82% rename from aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2HTTPResponse.java rename to aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayV2HTTPResponse.java index 2bd81fad..0ea4cac6 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayV2HTTPResponse.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayV2HTTPResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -11,13 +11,15 @@ * and limitations under the License. */ -package com.amazonaws.services.lambda.runtime.events; +package com.amazonaws.services.lambda.runtime.events.apigateway; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import com.fasterxml.jackson.annotation.JsonProperty; + import java.util.List; import java.util.Map; @@ -31,5 +33,6 @@ public class APIGatewayV2HTTPResponse { private Map> multiValueHeaders; private List cookies; private String body; + @JsonProperty("isBase64Encoded") private boolean isBase64Encoded; } diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayV2WebSocketEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayV2WebSocketEvent.java new file mode 100644 index 00000000..3ecda745 --- /dev/null +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayV2WebSocketEvent.java @@ -0,0 +1,109 @@ +/* + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with + * the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +package com.amazonaws.services.lambda.runtime.events.apigateway; + +import lombok.Data; +import lombok.Builder; +import lombok.NoArgsConstructor; +import lombok.AllArgsConstructor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** + * @author Tim Gustafson + */ +@Data +@Builder(setterPrefix = "with") +@NoArgsConstructor +@AllArgsConstructor +public class APIGatewayV2WebSocketEvent implements Serializable { + + private static final long serialVersionUID = 5695319264103347099L; + + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor + public static class RequestIdentity implements Serializable { + + private static final long serialVersionUID = -3276649362684921217L; + + private String cognitoIdentityPoolId; + private String accountId; + private String cognitoIdentityId; + private String caller; + private String apiKey; + private String apiKeyId; + private String sourceIp; + private String cognitoAuthenticationType; + private String cognitoAuthenticationProvider; + private String userArn; + private String userAgent; + private String user; + private String accessKey; + + } + + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor + public static class RequestContext implements Serializable { + + 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; + + } + + 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; + @JsonProperty("isBase64Encoded") + @Builder.Default private boolean isBase64Encoded = false; + +} diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayV2WebSocketResponse.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayV2WebSocketResponse.java new file mode 100644 index 00000000..8c518fef --- /dev/null +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/apigateway/APIGatewayV2WebSocketResponse.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with + * the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +package com.amazonaws.services.lambda.runtime.events.apigateway; + +import lombok.Data; +import lombok.Builder; +import lombok.NoArgsConstructor; +import lombok.AllArgsConstructor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; +import java.util.Map; + +/** + * @author Tim Gustafson + */ +@Data +@Builder(setterPrefix = "with") +@NoArgsConstructor +@AllArgsConstructor +public class APIGatewayV2WebSocketResponse implements Serializable { + + private static final long serialVersionUID = -5155789062248356200L; + + @JsonProperty("isBase64Encoded") + @Builder.Default private boolean isBase64Encoded = false; + private int statusCode; + private Map headers; + private Map multiValueHeaders; + private String body; + +} \ No newline at end of file diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoEvent.java new file mode 100644 index 00000000..82fe8fe7 --- /dev/null +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoEvent.java @@ -0,0 +1,103 @@ +/* + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with + * the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +package com.amazonaws.services.lambda.runtime.events.cognito; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Map; + +/** + * + * Represents an Amazon Cognito event sent to Lambda Functions + * + */ + +@Data +@Builder(setterPrefix = "with") +@NoArgsConstructor +@AllArgsConstructor +public class CognitoEvent implements Serializable, Cloneable { + + private static final long serialVersionUID = -3471890133562627751L; + + private String region; + + private Map datasetRecords; + + private String identityPoolId; + + private String identityId; + + private String datasetName; + + private String eventType; + + private Integer version; + + /** + * DatasetRecord contains the information about each record in a data set. + * + */ + + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor + public static class DatasetRecord implements Serializable, Cloneable { + + private static final long serialVersionUID = -8853471047466644850L; + + private String oldValue; + + private String newValue; + + /** + * The operation associated with the record + *

+ *

    + *
  • + * For a new record or any updates to existing record it is set to "replace". + *
  • + *
  • + * For deleting a record it is set to "remove". + *
  • + *
+ *

+ */ + private String op; + + @Override + public DatasetRecord clone() { + try { + return (DatasetRecord) super.clone(); + } catch (CloneNotSupportedException e) { + throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e); + } + } + } + + @Override + public CognitoEvent clone() { + try { + return (CognitoEvent) super.clone(); + } catch (CloneNotSupportedException e) { + throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e); + } + } + +} diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolCreateAuthChallengeEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolCreateAuthChallengeEvent.java similarity index 93% rename from aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolCreateAuthChallengeEvent.java rename to aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolCreateAuthChallengeEvent.java index 6739d27f..bfb48ab1 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolCreateAuthChallengeEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolCreateAuthChallengeEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -10,9 +10,14 @@ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package com.amazonaws.services.lambda.runtime.events; -import lombok.*; +package com.amazonaws.services.lambda.runtime.events.cognito; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.EqualsAndHashCode; import java.util.Map; diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolCustomMessageEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolCustomMessageEvent.java similarity index 92% rename from aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolCustomMessageEvent.java rename to aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolCustomMessageEvent.java index f8642c75..960d055a 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolCustomMessageEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolCustomMessageEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -10,9 +10,14 @@ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package com.amazonaws.services.lambda.runtime.events; -import lombok.*; +package com.amazonaws.services.lambda.runtime.events.cognito; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.EqualsAndHashCode; import java.util.Map; diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolDefineAuthChallengeEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolDefineAuthChallengeEvent.java similarity index 93% rename from aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolDefineAuthChallengeEvent.java rename to aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolDefineAuthChallengeEvent.java index 33fcf53a..aee5efd1 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolDefineAuthChallengeEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolDefineAuthChallengeEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -10,9 +10,14 @@ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package com.amazonaws.services.lambda.runtime.events; -import lombok.*; +package com.amazonaws.services.lambda.runtime.events.cognito; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.EqualsAndHashCode; import java.util.Map; diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolEvent.java similarity index 93% rename from aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolEvent.java rename to aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolEvent.java index 17c4b409..2ff02f23 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -10,12 +10,14 @@ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package com.amazonaws.services.lambda.runtime.events; + +package com.amazonaws.services.lambda.runtime.events.cognito; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import lombok.EqualsAndHashCode; import java.util.Map; diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolMigrateUserEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolMigrateUserEvent.java similarity index 94% rename from aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolMigrateUserEvent.java rename to aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolMigrateUserEvent.java index ee47c360..23e6e280 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolMigrateUserEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolMigrateUserEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -10,9 +10,14 @@ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package com.amazonaws.services.lambda.runtime.events; -import lombok.*; +package com.amazonaws.services.lambda.runtime.events.cognito; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.EqualsAndHashCode; import java.util.Map; diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolPostAuthenticationEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolPostAuthenticationEvent.java similarity index 89% rename from aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolPostAuthenticationEvent.java rename to aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolPostAuthenticationEvent.java index 5d2f5089..ee78e709 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolPostAuthenticationEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolPostAuthenticationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -10,12 +10,14 @@ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package com.amazonaws.services.lambda.runtime.events; +package com.amazonaws.services.lambda.runtime.events.cognito; + +import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; -import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; +import lombok.EqualsAndHashCode; import java.util.Map; @@ -36,6 +38,11 @@ public class CognitoUserPoolPostAuthenticationEvent extends CognitoUserPoolEvent */ private Request request; + /** + * No additional return information is expected in the response. + */ + private Object response; + @Builder(setterPrefix = "with") public CognitoUserPoolPostAuthenticationEvent( String version, diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolPostConfirmationEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolPostConfirmationEvent.java similarity index 88% rename from aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolPostConfirmationEvent.java rename to aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolPostConfirmationEvent.java index 340b2a88..79dd3774 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolPostConfirmationEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolPostConfirmationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -10,12 +10,14 @@ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package com.amazonaws.services.lambda.runtime.events; +package com.amazonaws.services.lambda.runtime.events.cognito; + +import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; -import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; +import lombok.EqualsAndHashCode; import java.util.Map; @@ -36,6 +38,11 @@ public class CognitoUserPoolPostConfirmationEvent extends CognitoUserPoolEvent { */ private Request request; + /** + * No additional return information is expected in the response. + */ + private Object response; + @Builder(setterPrefix = "with") public CognitoUserPoolPostConfirmationEvent( String version, diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolPreAuthenticationEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolPreAuthenticationEvent.java similarity index 90% rename from aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolPreAuthenticationEvent.java rename to aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolPreAuthenticationEvent.java index 26f45bb9..27d4e91f 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolPreAuthenticationEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolPreAuthenticationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -10,12 +10,14 @@ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package com.amazonaws.services.lambda.runtime.events; +package com.amazonaws.services.lambda.runtime.events.cognito; + +import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; -import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; +import lombok.EqualsAndHashCode; import java.util.Map; @@ -36,6 +38,11 @@ public class CognitoUserPoolPreAuthenticationEvent extends CognitoUserPoolEvent */ private Request request; + /** + * No additional return information is expected in the response. + */ + private Object response; + @Builder(setterPrefix = "with") public CognitoUserPoolPreAuthenticationEvent( String version, diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolPreSignUpEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolPreSignUpEvent.java similarity index 92% rename from aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolPreSignUpEvent.java rename to aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolPreSignUpEvent.java index 2a7f0e3f..69113173 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolPreSignUpEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolPreSignUpEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -10,9 +10,14 @@ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package com.amazonaws.services.lambda.runtime.events; -import lombok.*; +package com.amazonaws.services.lambda.runtime.events.cognito; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.EqualsAndHashCode; import java.util.Map; diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolPreTokenGenerationEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolPreTokenGenerationEvent.java similarity index 93% rename from aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolPreTokenGenerationEvent.java rename to aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolPreTokenGenerationEvent.java index db73bbd9..36bfb8ae 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolPreTokenGenerationEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolPreTokenGenerationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -10,9 +10,14 @@ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package com.amazonaws.services.lambda.runtime.events; -import lombok.*; +package com.amazonaws.services.lambda.runtime.events.cognito; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.EqualsAndHashCode; import java.util.Map; diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolVerifyAuthChallengeResponseEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolVerifyAuthChallengeResponseEvent.java similarity index 92% rename from aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolVerifyAuthChallengeResponseEvent.java rename to aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolVerifyAuthChallengeResponseEvent.java index 13aafb55..eb7a222b 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/CognitoUserPoolVerifyAuthChallengeResponseEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/cognito/CognitoUserPoolVerifyAuthChallengeResponseEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at @@ -10,9 +10,14 @@ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package com.amazonaws.services.lambda.runtime.events; -import lombok.*; +package com.amazonaws.services.lambda.runtime.events.cognito; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.EqualsAndHashCode; import java.util.Map; diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/dynamodb/DynamodbEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/dynamodb/DynamodbEvent.java new file mode 100644 index 00000000..939f84d4 --- /dev/null +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/dynamodb/DynamodbEvent.java @@ -0,0 +1,1532 @@ +/* + * Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with + * the License. A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +package com.amazonaws.services.lambda.runtime.events.dynamodb; + +import lombok.EqualsAndHashCode; +import lombok.ToString; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import lombok.Builder; +import lombok.Data; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.io.Serializable; +import java.util.List; + +/** + * Represents an Amazon DynamoDB event + */ +@Data +@Builder(setterPrefix = "with") +@NoArgsConstructor +@AllArgsConstructor +public class DynamodbEvent implements Serializable, Cloneable { + + private static final long serialVersionUID = -2354616079899981231L; + + @JsonProperty("Records") + private List records; + + /** + * The unit of data of an Amazon DynamoDB event + */ + @Data + @Builder(setterPrefix = "with") + @NoArgsConstructor + @AllArgsConstructor + public static class DynamodbStreamRecord implements Serializable, Cloneable { + + private static final long serialVersionUID = 3638381544604354963L; + + private String eventSourceARN; + + /** + *

+ * A globally unique identifier for the event that was recorded in this stream record. + *

+ */ + private String eventID; + /** + *

+ * The type of data modification that was performed on the DynamoDB table: + *

+ *
    + *
  • + *

    + * INSERT - a new item was added to the table. + *

    + *
  • + *
  • + *

    + * MODIFY - one or more of an existing item's attributes were modified. + *

    + *
  • + *
  • + *

    + * REMOVE - the item was deleted from the table + *

    + *
  • + *
+ */ + private String eventName; + /** + *

+ * The version number of the stream record format. This number is updated whenever the structure of + * Record is modified. + *

+ *

+ * Client applications must not assume that eventVersion will remain at a particular value, as this + * number is subject to change at any time. In general, eventVersion will only increase as the + * low-level DynamoDB Streams API evolves. + *

+ */ + private String eventVersion; + /** + *

+ * The AWS service from which the stream record originated. For DynamoDB Streams, this is aws:dynamodb. + *

+ */ + private String eventSource; + /** + *

+ * The region in which the GetRecords request was received. + *

+ */ + private String awsRegion; + /** + *

+ * The main body of the stream record, containing all of the DynamoDB-specific fields. + *

+ */ + private StreamRecord dynamodb; + /** + *

+ * Items that are deleted by the Time to Live process after expiration have the following fields: + *

+ *
    + *
  • + *

    + * Records[].userIdentity.type + *

    + *

    + * "Service" + *

    + *
  • + *
  • + *

    + * Records[].userIdentity.principalId + *

    + *

    + * "dynamodb.amazonaws.com" + *

    + *
  • + *
+ */ + private Identity userIdentity; + + /** + *

+ * The type of data modification that was performed on the DynamoDB table: + *

+ *
    + *
  • + *

    + * INSERT - a new item was added to the table. + *

    + *
  • + *
  • + *

    + * MODIFY - one or more of an existing item's attributes were modified. + *

    + *
  • + *
  • + *

    + * REMOVE - the item was deleted from the table + *

    + *
  • + *
+ * + * @param eventName + * The type of data modification that was performed on the DynamoDB table:

+ *