Skip navigation links

AWS SDK for Java 1.x API Reference - 1.12.777

We announced the upcoming end-of-support for AWS SDK for Java (v1). We recommend that you migrate to AWS SDK for Java v2. For dates, additional details, and information on how to migrate, please refer to the linked announcement.

Package com.amazonaws.services.lambda.invoke

A higher-level wrapper for AWS Lambda's Invoke operation.

See: Description

Package com.amazonaws.services.lambda.invoke Description

A higher-level wrapper for AWS Lambda's Invoke operation. Allows you to model the input and/or output of your Lambda functions as POJOs and transparently invoke operations using your model types.

Step 1: Model your function's input and/or output as a set of Java POJOs and/or Exceptions.

public class AddRequest { private final int leftHandSide; private final int rightHandSide; public AddRequest(int leftHandSide, int rightHandSide) { this.leftHandSide = leftHandSide; this.rightHandSide = rightHandSide; } public int getLeftHandSide() { return leftHandSide; } public int getRightHandSide() { return rightHandSide; } } public class AddResult { private int sum; public int getSum() { return sum; } public void setSum(int sum) { this.sum = sum; } } public class OverflowException extends LambdaFunctionException { public AddException(String message) { super(message, true, "Overflow"); } }

Input types will be automatically converted to JSON to pass to your Lambda function. The JSON response from your function will be converted to the corresponding result type.

Step 2: Create an interface representing your function(s).

public interface CloudAdder {