Example usage for com.amazonaws.services.lambda.model CreateFunctionRequest setTimeout

List of usage examples for com.amazonaws.services.lambda.model CreateFunctionRequest setTimeout

Introduction

In this page you can find the example usage for com.amazonaws.services.lambda.model CreateFunctionRequest setTimeout.

Prototype


public void setTimeout(Integer timeout) 

Source Link

Document

The amount of time that Lambda allows a function to run before stopping it.

Usage

From source file:com.netflix.spinnaker.clouddriver.lambda.deploy.ops.CreateLambdaAtomicOperation.java

License:Apache License

private CreateFunctionResult createFunction() {
    FunctionCode code = new FunctionCode().withS3Bucket(description.getProperty("s3bucket").toString())
            .withS3Key(description.getProperty("s3key").toString());

    Map<String, String> objTag = new HashMap<>();
    for (Map<String, String> tags : description.getTags()) {
        for (Entry<String, String> entry : tags.entrySet()) {
            objTag.put(entry.getKey(), entry.getValue());
        }//w ww  .j  av  a  2s.co m
    }

    AWSLambda client = getLambdaClient();

    CreateFunctionRequest request = new CreateFunctionRequest();
    request.setFunctionName(description.getFunctionName());
    request.setDescription(description.getDescription());
    request.setHandler(description.getHandler());
    request.setMemorySize(description.getMemory());
    request.setPublish(description.getPublish());
    request.setRole(description.getRole());
    request.setRuntime(description.getRuntime());
    request.setTimeout(description.getTimeout());

    request.setCode(code);
    request.setTags(objTag);

    CreateFunctionResult result = client.createFunction(request);
    updateTaskStatus("Finished Creation of AWS Lambda Function Operation...");

    return result;
}