Skip to content

Commit 2f44560

Browse files
RomainMullermergify[bot]
authored andcommitted
chore: update Java examples (#144)
* chore: update Java examples * fixup dependency declarations
1 parent d58ff8d commit 2f44560

File tree

6 files changed

+25
-57
lines changed

6 files changed

+25
-57
lines changed

java/hello-world/pom.xml

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -55,52 +55,38 @@
5555
<dependency>
5656
<groupId>software.amazon.awscdk</groupId>
5757
<artifactId>core</artifactId>
58-
<version>1.0.0.DEVPREVIEW</version>
58+
<version>1.14.0.DEVPREVIEW</version>
5959
</dependency>
6060
<dependency>
6161
<groupId>software.amazon.awscdk</groupId>
6262
<artifactId>autoscaling</artifactId>
63-
<version>1.0.0.DEVPREVIEW</version>
63+
<version>1.14.0.DEVPREVIEW</version>
6464
</dependency>
6565

6666
<dependency>
6767
<groupId>software.amazon.awscdk</groupId>
6868
<artifactId>ec2</artifactId>
69-
<version>1.0.0.DEVPREVIEW</version>
69+
<version>1.14.0.DEVPREVIEW</version>
7070
</dependency>
7171
<dependency>
7272
<groupId>software.amazon.awscdk</groupId>
7373
<artifactId>s3</artifactId>
74-
<version>1.0.0.DEVPREVIEW</version>
74+
<version>1.14.0.DEVPREVIEW</version>
7575
</dependency>
7676
<dependency>
7777
<groupId>software.amazon.awscdk</groupId>
7878
<artifactId>sns</artifactId>
79-
<version>1.0.0.DEVPREVIEW</version>
79+
<version>1.14.0.DEVPREVIEW</version>
8080
</dependency>
8181
<dependency>
8282
<groupId>software.amazon.awscdk</groupId>
8383
<artifactId>sqs</artifactId>
84-
<version>1.0.0.DEVPREVIEW</version>
84+
<version>1.14.0.DEVPREVIEW</version>
8585
</dependency>
8686
<dependency>
8787
<groupId>software.amazon.awscdk</groupId>
8888
<artifactId>sns-subscriptions</artifactId>
89-
<version>1.0.0.DEVPREVIEW</version>
90-
</dependency>
91-
92-
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
93-
<dependency>
94-
<groupId>com.fasterxml.jackson.core</groupId>
95-
<artifactId>jackson-core</artifactId>
96-
<version>2.9.8</version>
97-
</dependency>
98-
99-
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
100-
<dependency>
101-
<groupId>com.fasterxml.jackson.core</groupId>
102-
<artifactId>jackson-databind</artifactId>
103-
<version>2.9.8</version>
89+
<version>1.14.0.DEVPREVIEW</version>
10490
</dependency>
10591

10692
<!-- https://mvnrepository.com/artifact/junit/junit -->

java/hello-world/src/main/java/software/amazon/awscdk/examples/HelloJavaStack.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ static class MyAutoScalingGroup extends Construct {
4444
super(parent, name);
4545

4646
new AutoScalingGroup(this, "Compute", AutoScalingGroupProps.builder()
47-
.withInstanceType(new InstanceType("t2.micro"))
48-
.withMachineImage(new AmazonLinuxImage())
49-
.withVpc(props.vpc)
47+
.instanceType(new InstanceType("t2.micro"))
48+
.machineImage(new AmazonLinuxImage())
49+
.vpc(props.vpc)
5050
.build());
5151
}
5252

java/hello-world/src/test/java/software/amazon/awscdk/examples/SinkQueueTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class SinkQueueTest {
3535
Stack stack = new Stack();
3636
new SinkQueue(stack, "MySinkQueue", SinkQueueProps.builder()
3737
.withQueueProps(QueueProps.builder()
38-
.withVisibilityTimeout(Duration.seconds(500))
38+
.visibilityTimeout(Duration.seconds(500))
3939
.build())
4040
.build());
4141
assertTemplate(stack, "{\n" +

java/lambda-cron/pom.xml

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,33 +55,19 @@
5555
<dependency>
5656
<groupId>software.amazon.awscdk</groupId>
5757
<artifactId>core</artifactId>
58-
<version>1.0.0.DEVPREVIEW</version>
58+
<version>1.12.0.DEVPREVIEW</version>
5959
</dependency>
6060

6161
<dependency>
6262
<groupId>software.amazon.awscdk</groupId>
6363
<artifactId>lambda</artifactId>
64-
<version>1.0.0.DEVPREVIEW</version>
64+
<version>1.12.0.DEVPREVIEW</version>
6565
</dependency>
6666

6767
<dependency>
6868
<groupId>software.amazon.awscdk</groupId>
6969
<artifactId>events-targets</artifactId>
70-
<version>1.0.0.DEVPREVIEW</version>
71-
</dependency>
72-
73-
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
74-
<dependency>
75-
<groupId>com.fasterxml.jackson.core</groupId>
76-
<artifactId>jackson-core</artifactId>
77-
<version>2.9.8</version>
78-
</dependency>
79-
80-
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
81-
<dependency>
82-
<groupId>com.fasterxml.jackson.core</groupId>
83-
<artifactId>jackson-databind</artifactId>
84-
<version>2.9.8</version>
70+
<version>1.12.0.DEVPREVIEW</version>
8571
</dependency>
8672

8773
<!-- https://mvnrepository.com/artifact/junit/junit -->

java/lambda-cron/src/main/java/software/amazon/awscdk/examples/LambdaCronStack.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,24 @@ public LambdaCronStack(final Construct parent, final String name) {
2323

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

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

4444
rule.addTarget(new LambdaFunction(lambdaFunction));
4545
}
46-
}
46+
}

java/lambda-cron/src/test/resources/software/amazon/awscdk/examples/testCronLambdaExpected.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@
2828
"Action" : "sts:AssumeRole",
2929
"Effect" : "Allow",
3030
"Principal" : {
31-
"Service" : {
32-
"Fn::Join" : [ "", [ "lambda.", {
33-
"Ref" : "AWS::URLSuffix"
34-
} ] ]
35-
}
31+
"Service" : "lambda.amazonaws.com"
3632
}
3733
} ]
3834
}
@@ -67,4 +63,4 @@
6763
}
6864
}
6965
}
70-
}
66+
}

0 commit comments

Comments
 (0)