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

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

Introduction

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

Prototype


public void setTags(java.util.Map<String, String> tags) 

Source Link

Document

<p> A list of <a href="https://docs.aws.amazon.com/lambda/latest/dg/tagging.html">tags</a> to apply to the function.

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  ww  w . j  a  va  2s  . 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;
}