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
#!/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
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
package io.symphonia; | |
public class MyLambda { | |
public String handler(String input) { | |
String message = String.format("Hello, %s!", input); | |
System.out.println("Logging: message"); | |
return message; | |
} | |
} |
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 MyLambda { | |
public void handler(String input) { | |
String message = String.format("Hello, %s!", input); | |
System.out.println(message); | |
} | |
} |
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 class MyLambda { | |
public void handler(S3Put input) { | |
// Execution code will go here | |
} | |
public static class S3Put { | |
public java.util.List<S3PutRecord> Records; | |
public static class S3PutRecord { | |
public S3PutRecordS3 s3; |
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 void handler(S3Put input) { | |
final String key = input.Records.get(0).s3.object.key; | |
System.out.println("S3 PUT happened! Key was: " + key); | |
} |
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.InputStream; | |
import java.io.OutputStream; | |
public class WhatIsMyLambdaEvent { | |
public void handler(InputStream is, OutputStream os) { | |
java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A"); | |
System.out.println(s.hasNext() ? s.next() : "No input detected"); | |
} |
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 int containerExecutionCount = 0; | |
public void handler(Map<String, List<S3PutRecord>> input) { | |
final String key = input.get("Records").get(0).s3.object.key; | |
System.out.println("S3 PUT happened! Key was: " + key); | |
throw new RuntimeException("Throwing exception. This container has processed " + ++containerExecutionCount + " events"); | |
} |
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 class MyLambda { | |
public String handler(Object input) { | |
return "Hello Lambda"; | |
} | |
} |