cloud.localstack.LambdaExecutor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of localstack-utils Show documentation
Show all versions of localstack-utils Show documentation
Java utilities for the LocalStack platform.
package cloud.localstack;
import java.io.File;
import java.nio.ByteBuffer;
import java.util.Base64;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import com.amazonaws.services.lambda.runtime.events.KinesisEvent;
import com.amazonaws.services.lambda.runtime.events.KinesisEvent.KinesisEventRecord;
import com.amazonaws.services.lambda.runtime.events.KinesisEvent.Record;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.codec.Charsets;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
/**
* Simple implementation of a Java Lambda function executor.
*
* @author Waldemar Hummer
*/
public class LambdaExecutor {
@SuppressWarnings("unchecked")
public static void main(String[] args) throws Exception {
if(args.length < 2) {
System.err.println("Usage: java " + LambdaExecutor.class.getSimpleName() +
" ");
System.exit(1);
}
String fileContent = readFile(args[1]);
ObjectMapper reader = new ObjectMapper();
@SuppressWarnings("deprecation")
Map map = reader.reader(Map.class).readValue(fileContent);
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy