Skip to content

Commit

Permalink
chore: update Java examples (aws-samples#144)
Browse files Browse the repository at this point in the history
* chore: update Java examples

* fixup dependency declarations
  • Loading branch information
RomainMuller authored and mergify[bot] committed Nov 1, 2019
1 parent d58ff8d commit 2f44560
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 57 deletions.
28 changes: 7 additions & 21 deletions java/hello-world/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,52 +55,38 @@
<dependency>
<groupId>software.amazon.awscdk</groupId>
<artifactId>core</artifactId>
<version>1.0.0.DEVPREVIEW</version>
<version>1.14.0.DEVPREVIEW</version>
</dependency>
<dependency>
<groupId>software.amazon.awscdk</groupId>
<artifactId>autoscaling</artifactId>
<version>1.0.0.DEVPREVIEW</version>
<version>1.14.0.DEVPREVIEW</version>
</dependency>

<dependency>
<groupId>software.amazon.awscdk</groupId>
<artifactId>ec2</artifactId>
<version>1.0.0.DEVPREVIEW</version>
<version>1.14.0.DEVPREVIEW</version>
</dependency>
<dependency>
<groupId>software.amazon.awscdk</groupId>
<artifactId>s3</artifactId>
<version>1.0.0.DEVPREVIEW</version>
<version>1.14.0.DEVPREVIEW</version>
</dependency>
<dependency>
<groupId>software.amazon.awscdk</groupId>
<artifactId>sns</artifactId>
<version>1.0.0.DEVPREVIEW</version>
<version>1.14.0.DEVPREVIEW</version>
</dependency>
<dependency>
<groupId>software.amazon.awscdk</groupId>
<artifactId>sqs</artifactId>
<version>1.0.0.DEVPREVIEW</version>
<version>1.14.0.DEVPREVIEW</version>
</dependency>
<dependency>
<groupId>software.amazon.awscdk</groupId>
<artifactId>sns-subscriptions</artifactId>
<version>1.0.0.DEVPREVIEW</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.8</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.8</version>
<version>1.14.0.DEVPREVIEW</version>
</dependency>

<!-- https://mvnrepository.com/artifact/junit/junit -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ static class MyAutoScalingGroup extends Construct {
super(parent, name);

new AutoScalingGroup(this, "Compute", AutoScalingGroupProps.builder()
.withInstanceType(new InstanceType("t2.micro"))
.withMachineImage(new AmazonLinuxImage())
.withVpc(props.vpc)
.instanceType(new InstanceType("t2.micro"))
.machineImage(new AmazonLinuxImage())
.vpc(props.vpc)
.build());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class SinkQueueTest {
Stack stack = new Stack();
new SinkQueue(stack, "MySinkQueue", SinkQueueProps.builder()
.withQueueProps(QueueProps.builder()
.withVisibilityTimeout(Duration.seconds(500))
.visibilityTimeout(Duration.seconds(500))
.build())
.build());
assertTemplate(stack, "{\n" +
Expand Down
20 changes: 3 additions & 17 deletions java/lambda-cron/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,33 +55,19 @@
<dependency>
<groupId>software.amazon.awscdk</groupId>
<artifactId>core</artifactId>
<version>1.0.0.DEVPREVIEW</version>
<version>1.12.0.DEVPREVIEW</version>
</dependency>

<dependency>
<groupId>software.amazon.awscdk</groupId>
<artifactId>lambda</artifactId>
<version>1.0.0.DEVPREVIEW</version>
<version>1.12.0.DEVPREVIEW</version>
</dependency>

<dependency>
<groupId>software.amazon.awscdk</groupId>
<artifactId>events-targets</artifactId>
<version>1.0.0.DEVPREVIEW</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.8</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.8</version>
<version>1.12.0.DEVPREVIEW</version>
</dependency>

<!-- https://mvnrepository.com/artifact/junit/junit -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,24 @@ public LambdaCronStack(final Construct parent, final String name) {

SingletonFunction lambdaFunction = new SingletonFunction(this, "cdk-lambda-cron",
SingletonFunctionProps.builder()
.withDescription("Lambda which prints \"I'm running\"")
.withCode(Code.inline(
.description("Lambda which prints \"I'm running\"")
.code(Code.fromInline(
"def main(event, context):\n" +
" print(\"I'm running!\")\n"))
.withHandler("index.main")
.withTimeout(Duration.seconds(300))
.withRuntime(Runtime.PYTHON_2_7)
.withUuid(UUID.randomUUID().toString())
.handler("index.main")
.timeout(Duration.seconds(300))
.runtime(Runtime.PYTHON_2_7)
.uuid(UUID.randomUUID().toString())
.build()
);

Rule rule = new Rule(this, "cdk-lambda-cron-rule",
RuleProps.builder()
.withDescription("Run every day at 6PM UTC")
.withSchedule(Schedule.expression("cron(0 18 ? * MON-FRI *)"))
.description("Run every day at 6PM UTC")
.schedule(Schedule.expression("cron(0 18 ? * MON-FRI *)"))
.build()
);

rule.addTarget(new LambdaFunction(lambdaFunction));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@
"Action" : "sts:AssumeRole",
"Effect" : "Allow",
"Principal" : {
"Service" : {
"Fn::Join" : [ "", [ "lambda.", {
"Ref" : "AWS::URLSuffix"
} ] ]
}
"Service" : "lambda.amazonaws.com"
}
} ]
}
Expand Down Expand Up @@ -67,4 +63,4 @@
}
}
}
}
}

0 comments on commit 2f44560

Please sign in to comment.