Set up initial Lambda sturucture with Cognito

Create demo Lambda/Gateway pair with Cognito integration
This commit is contained in:
NMerz
2020-09-20 16:26:13 -04:00
parent 2b1ecbadef
commit f576307e0a
11 changed files with 129 additions and 8 deletions

28
Lambdas/Lists/pom.xml Normal file
View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>groupId</groupId>
<artifactId>Lists</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-core</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-events</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-log4j2</artifactId>
<version>1.2.0</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,22 @@
import java.util.Map;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
public class ListAdd implements RequestHandler<Map<String,Object>, String>{
public String handleRequest(Map<String, Object> inputMap, Context unfilled) {
System.out.println(inputMap.keySet());
System.out.println(inputMap.entrySet());
Map<String, Object> contextMap;
if ((inputMap.get("context") != null) && (inputMap.get("context") instanceof Map<?, ?>)) {
contextMap = ((Map<String, Object>) inputMap.get("context"));
} else {
throw new IllegalArgumentException("The key \"Context\" must exist and be a map");
}
System.out.println(inputMap.get("context"));
System.out.println(contextMap.get("sub"));
return null;
}
}