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

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

Introduction

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

Prototype


public void setRole(String role) 

Source Link

Document

The Amazon Resource Name (ARN) of the function's execution role.

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());
        }/*from  w ww. j ava  2 s  . c  o 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;
}