This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package io.symphonia; | |
| public class PojoLambda { | |
| public PojoResponse handlerPojo(PojoInput input) { | |
| return new PojoResponse("Input was " + input.c); | |
| } | |
| public static class PojoInput { | |
| public String c; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Creates a Lambda and API Gateway proxying any verb on any path to lambda | |
| # | |
| # PREREQUISITES | |
| # | |
| # You must have the following installed locally: Java 8, mvn, AWS CLI | |
| # Your AWS CLI must be configured for a user that has the necessary privileges | |
| # You must have a basic role 'lambda_basic_execution' defined - this is what is created | |
| # the first time you create a Lambda function in the web console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public String handler(String s) { | |
| return "Hello, " + s; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <dependency> | |
| <groupId>com.amazonaws</groupId> | |
| <artifactId>aws-lambda-java-core</artifactId> | |
| <version>1.1.0</version> | |
| <scope>provided</scope> | |
| </dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package io.symphonia; | |
| import com.amazonaws.services.lambda.runtime.Context; | |
| import java.util.HashMap; | |
| import java.util.Map; | |
| public class ContextLambda { | |
| public Map<String,Object> handler (Object input, Context context) { | |
| Map<String, Object> toReturn = new HashMap<>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package io.symphonia; | |
| import java.io.IOException; | |
| import java.io.InputStream; | |
| import java.io.OutputStream; | |
| public class StreamLambda { | |
| public void handlerStream(InputStream inputStream, OutputStream outputStream) throws IOException { | |
| int letter; | |
| while((letter = inputStream.read()) != -1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public Object handleRequest(S3Event input) { | |
| // … | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package io.symphonia; | |
| public class PojoLambda { | |
| public PojoResponse handlerPojo(PojoInput input) { | |
| return new PojoResponse("Input was " + input.getA()); | |
| } | |
| public static class PojoInput { | |
| private String a; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package io.symphonia; | |
| import java.util.ArrayList; | |
| import java.util.HashMap; | |
| import java.util.List; | |
| import java.util.Map; | |
| public class ListMapLambda { | |
| public List<Integer> handlerList(List<Integer> input) { | |
| List<Integer> newList = new ArrayList<>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package io.symphonia; | |
| public class StringIntegerBooleanLambda { | |
| public String handlerString(String s) { | |
| return "Hello, " + s; | |
| } | |
| public int handlerInt(int input) { | |
| return 100 + input; | |
| } |