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
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>org.example</groupId> | |
<artifactId>aws-lambda-java-terraform</artifactId> | |
<version>1.0</version> | |
<name>Archetype - aws-coffee.tips.lambda-java-terraform</name> | |
<url>http://maven.apache.org</url> | |
<dependencies> |
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
package coffee.tips.lambda; | |
import com.amazonaws.services.lambda.runtime.Context; | |
import com.amazonaws.services.lambda.runtime.LambdaLogger; | |
import com.amazonaws.services.lambda.runtime.RequestHandler; | |
import java.util.Map; | |
public class Handler implements RequestHandler<Map<String, Object>, Void> { |
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
variable "region" { | |
default = "us-east-1" | |
} | |
variable "bucket" {} | |
variable "lambda_function" {} | |
variable "lambda_filename" {} | |
variable "file_location" {} | |
variable "lambda_handler" {} | |
variable "runtime" {} |
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
bucket = "your.bucket.name.must.be.unique" | |
lambda_function = "coffee_tips_aws_lambda" | |
lambda_filename = "aws-lambda-terraform-java-1.0.jar" | |
file_location = "../target/aws-lambda-terraform-java-1.0.jar" | |
lambda_handler = "coffee.tips.lambda.Handler" | |
runtime = "java11" | |
cron = "rate(2 minutes)" | |
timeout = 2 |
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
provider "aws" { | |
region = var.region | |
} |
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
resource "aws_s3_bucket" "bucket" { | |
bucket = var.bucket | |
} |
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
data "aws_iam_policy_document" "coffee_tips_aws_lambda_iam_policy_document" { | |
statement { | |
effect = "Allow" | |
principals { | |
type = "Service" | |
identifiers = ["lambda.amazonaws.com"] | |
} | |
actions = ["sts:AssumeRole"] |
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
List<String> names = | |
Arrays.asList("Monica Souza", | |
"Andre Silva", | |
"Elisa Santos", | |
"Adrian Silva"); | |
Optional<String> opt = | |
names.stream() | |
.findFirst(); | |
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
Optional<String> opt = | |
names.stream() | |
.filter(f -> f.contains("Silva")) | |
.findFirst(); | |
System.out.println("Item:" + opt.get()); |
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
for(String item : list){ | |
if(item.contains("Silva")){ | |
break; | |
} | |
} |
OlderNewer