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 Handler implements RequestHandler<Map<String, Object>, ApiGatewayResponse> { | |
private static final Logger LOG = Logger.getLogger(Handler.class); | |
@Override | |
public ApiGatewayResponse handleRequest(Map<String, Object> input, Context context) { | |
LOG.info("received: " + input); | |
Response responseBody = new Response("Go Serverless v1.x! Your function executed successfully!", input); | |
return ApiGatewayResponse.builder() | |
.setStatusCode(200) | |
.setObjectBody(responseBody) | |
.setHeaders(Collections.singletonMap("X-Powered-By", "AWS Lambda & serverless")) |
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
functions: | |
hello: | |
handler: com.serverless.Handler | |
# from here down is new | |
events: | |
- http: | |
path: myresourcepath | |
method: ANY |
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
@ComponentScan( | |
basePackages = "your.base.package", | |
excludeFilters = {@Filter(type = ASSIGNABLE_TYPE, value = { | |
ExcludedAppConfig1.class, ExcludedAppConfig2.class}) | |
}) | |
public class TestConfig { ... | |
} |
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
functions: | |
hello: # defines a function named "hello" | |
handler: com.serverless.Handler # tells the framework where to find the entry point |
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
functions: | |
bookStoreApp: # the bookStoreApp function houses the whole app | |
handler: com.springbootslsdemo.SpringLambdaHandler | |
events: | |
- http: | |
path: / | |
method: ANY | |
- http: | |
path: /{proxy+} # all REST resource paths will lead to this function being invoked | |
# the spring boot framework will handle the routing to the correct classes |
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
functions: | |
create: #defines a function named create | |
handler: com.notesservice.CreateNote # points to the location of the code to invoke | |
events: # defines what type of event will trigger the invocation | |
- http: # creates a REST endpoint for you | |
path: notes # calling POST - {apiGatewayUrl}/notes will lead to this function's invocation | |
method: post | |
get: | |
handler: com.notesservice.GetNote | |
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
const params = { | |
FunctionName: "my-function", InvocationType: "Event", Payload: "<Binary String>", Qualifier: "1" | |
}; | |
lambda.invoke(params, function (err, data) { | |
if (err) console.log(err, err.stack); // an error occurred | |
else console.log(data); // successful response | |
}); |
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
if (accessKey == null) { | |
logger.info("Creating Lambda client without credentials the container will use task IAM role "); | |
Regions region = Regions.fromName(this.region); | |
AWSLambdaClientBuilder builder = AWSLambdaClientBuilder.standard() | |
.withRegion(region); | |
client = builder.build(); | |
} else { | |
logger.info("Creating Lambda client with provided access and secret key"); | |
Regions region = Regions.fromName(this.region); | |
BasicAWSCredentials credentials = new BasicAWSCredentials(accessKey, secret); |
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
- PolicyName: zeebeWorkerInvokePolicy | |
PolicyDocument: | |
Version: '2012-10-17' | |
Statement: # we are granting the following permissions to the following resources | |
- Effect: Allow | |
Action: | |
- lambda:InvokeFunction | |
- lambda:InvokeAsync | |
# resolves to 'arn:aws:lambda:*:<your-acct-id>:function:trip-booking-functions*' | |
Resource: |