Skip to content

Commit b09ec6c

Browse files
committed
Update aws-lambda-java-events to version 3.0.0 in transformer lib, bump to 2.0.0
1 parent 9218c9c commit b09ec6c

File tree

9 files changed

+75
-81
lines changed

9 files changed

+75
-81
lines changed

aws-lambda-java-events-sdk-transformer/README.md

+3-9
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ Add the following Apache Maven dependencies to your `pom.xml` file:
1616
<dependency>
1717
<groupId>com.amazonaws</groupId>
1818
<artifactId>aws-lambda-java-events-sdk-transformer</artifactId>
19-
<version>1.0.0</version>
19+
<version>2.0.0</version>
2020
</dependency>
2121
<dependency>
2222
<groupId>com.amazonaws</groupId>
2323
<artifactId>aws-lambda-java-events</artifactId>
24-
<version>2.2.9</version>
24+
<version>3.0.0</version>
2525
</dependency>
2626
</dependencies>
2727
```
2828

29-
To use this library as a transformer to the AWS DynamoDB Java SDK v2, also add the following dependencies to your `pom.xml` file:
29+
To use this library as a transformer to the AWS DynamoDB Java SDK v2, also add the following dependency to your `pom.xml` file:
3030

3131
```xml
3232
<dependencies>
@@ -35,14 +35,8 @@ To use this library as a transformer to the AWS DynamoDB Java SDK v2, also add t
3535
<artifactId>dynamodb</artifactId>
3636
<version>2.11.12</version>
3737
</dependency>
38-
<dependency>
39-
<groupId>com.amazonaws</groupId>
40-
<artifactId>aws-java-sdk-dynamodb</artifactId>
41-
<version>1.11.163</version>
42-
</dependency>
4338
</dependencies>
4439
```
45-
*Note that because `aws-lambda-java-events` version 2 requires the DynamoDB v1 SDK, this is also required for this library.*
4640

4741

4842
### Example Usage
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### May 20, 2020
2+
`2.0.0`:
3+
- Updated AWS SDK V2 transformers for `DynamodbEvent` to work with `aws-lambda-java-events` versions `3.0.0` and up
4+
15
### Apr 29, 2020
26
`1.0.0`:
37
- Added AWS SDK V2 transformers for `DynamodbEvent` in `aws-lambda-java-events` versions up to and including `2.x`

aws-lambda-java-events-sdk-transformer/pom.xml

+1-7
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,10 @@
5252
<version>2.11.12</version>
5353
<scope>provided</scope>
5454
</dependency>
55-
<dependency>
56-
<groupId>com.amazonaws</groupId>
57-
<artifactId>aws-java-sdk-dynamodb</artifactId>
58-
<version>1.11.163</version>
59-
<scope>provided</scope>
60-
</dependency>
6155
<dependency>
6256
<groupId>com.amazonaws</groupId>
6357
<artifactId>aws-lambda-java-events</artifactId>
64-
<version>2.2.9</version>
58+
<version>3.0.0</version>
6559
<scope>provided</scope>
6660
</dependency>
6761

aws-lambda-java-events-sdk-transformer/src/main/java/com/amazonaws/services/lambda/runtime/events/transformers/dynamodb/DynamodbAttributeValueTransformer.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
public class DynamodbAttributeValueTransformer {
1111

12-
public static AttributeValue toAttributeValueV2(final com.amazonaws.services.dynamodbv2.model.AttributeValue value) {
12+
public static AttributeValue toAttributeValueV2(final com.amazonaws.services.lambda.runtime.events.models.dynamodb.AttributeValue value) {
1313
if (Objects.nonNull(value.getS())) {
1414
return AttributeValue.builder()
1515
.s(value.getS())
@@ -71,7 +71,7 @@ public static AttributeValue toAttributeValueV2(final com.amazonaws.services.dyn
7171
}
7272

7373
static Map<String, AttributeValue> toAttributeValueMapV2(
74-
final Map<String, com.amazonaws.services.dynamodbv2.model.AttributeValue> attributeValueMap
74+
final Map<String, com.amazonaws.services.lambda.runtime.events.models.dynamodb.AttributeValue> attributeValueMap
7575
) {
7676
return attributeValueMap
7777
.entrySet()

aws-lambda-java-events-sdk-transformer/src/main/java/com/amazonaws/services/lambda/runtime/events/transformers/dynamodb/DynamodbIdentityTransformer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
public class DynamodbIdentityTransformer {
66

7-
public static Identity toIdentityV2(final com.amazonaws.services.dynamodbv2.model.Identity identity) {
7+
public static Identity toIdentityV2(final com.amazonaws.services.lambda.runtime.events.models.dynamodb.Identity identity) {
88
return Identity.builder()
99
.principalId(identity.getPrincipalId())
1010
.type(identity.getType())

aws-lambda-java-events-sdk-transformer/src/main/java/com/amazonaws/services/lambda/runtime/events/transformers/dynamodb/DynamodbStreamRecordTransformer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
public class DynamodbStreamRecordTransformer {
66

7-
public static StreamRecord toStreamRecordV2(final com.amazonaws.services.dynamodbv2.model.StreamRecord streamRecord) {
7+
public static StreamRecord toStreamRecordV2(final com.amazonaws.services.lambda.runtime.events.models.dynamodb.StreamRecord streamRecord) {
88
return StreamRecord.builder()
99
.approximateCreationDateTime(
1010
streamRecord.getApproximateCreationDateTime().toInstant()

aws-lambda-java-events-sdk-transformer/src/test/java/com/amazonaws/services/lambda/runtime/events/transformers/dynamodb/DynamodbAttributeValueTransformerTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.amazonaws.services.lambda.runtime.events.transformers.dynamodb;
22

3-
import com.amazonaws.services.dynamodbv2.model.AttributeValue;
3+
import com.amazonaws.services.lambda.runtime.events.models.dynamodb.AttributeValue;
44
import org.junit.jupiter.api.Assertions;
55
import org.junit.jupiter.api.Test;
66
import software.amazon.awssdk.core.SdkBytes;

aws-lambda-java-events-sdk-transformer/src/test/java/com/amazonaws/services/lambda/runtime/events/transformers/dynamodb/DynamodbIdentityTransformerTest.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ class DynamodbIdentityTransformerTest {
1010
private static final String identityType = "type";
1111

1212
//region Identity_event
13-
public static final com.amazonaws.services.dynamodbv2.model.Identity identity_event = new com.amazonaws.services.dynamodbv2.model.Identity()
14-
.withPrincipalId(principalId)
15-
.withType(identityType);
13+
public static final com.amazonaws.services.lambda.runtime.events.models.dynamodb.Identity identity_event =
14+
new com.amazonaws.services.lambda.runtime.events.models.dynamodb.Identity()
15+
.withPrincipalId(principalId)
16+
.withType(identityType);
1617
//endregion
1718

1819
//region Identity_v2
1920
public static final Identity identity_v2 = Identity.builder()
20-
.principalId(principalId)
21-
.type(identityType)
22-
.build();
21+
.principalId(principalId)
22+
.type(identityType)
23+
.build();
2324
//endregion
2425

2526
@Test

aws-lambda-java-events-sdk-transformer/src/test/java/com/amazonaws/services/lambda/runtime/events/transformers/dynamodb/DynamodbStreamRecordTransformerTest.java

+55-54
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.amazonaws.services.lambda.runtime.events.transformers.dynamodb;
22

3-
import com.amazonaws.services.dynamodbv2.model.AttributeValue;
4-
import com.amazonaws.services.dynamodbv2.model.StreamViewType;
3+
import com.amazonaws.services.lambda.runtime.events.models.dynamodb.AttributeValue;
4+
import com.amazonaws.services.lambda.runtime.events.models.dynamodb.StreamViewType;
55
import org.junit.jupiter.api.Assertions;
66
import org.junit.jupiter.api.Test;
77
import software.amazon.awssdk.services.dynamodb.model.StreamRecord;
@@ -37,62 +37,63 @@ class DynamodbStreamRecordTransformerTest {
3737
private static final Date approximateCreationDateTime = new Date();
3838

3939
//region StreamRecord_event
40-
public static final com.amazonaws.services.dynamodbv2.model.StreamRecord streamRecord_event = new com.amazonaws.services.dynamodbv2.model.StreamRecord()
41-
.withKeys(ImmutableMap.<String, AttributeValue> builder()
42-
.put(keyNK, attributeValueN_event)
43-
.put(keyNSK, attributeValueNS_event)
44-
.put(keySK, attributeValueS_event)
45-
.put(keySSK, attributeValueSS_event)
46-
.put(keyBK, attributeValueB_event)
47-
.put(keyBSK, attributeValueBS_event)
48-
.put(keyBOOLK, attributeValueBOOL_event)
49-
.put(keyNULK, attributeValueNUL_event)
50-
.put(keyMK, attributeValueM_event)
51-
.put(keyLK, attributeValueL_event)
52-
.build()
53-
)
54-
.withOldImage(ImmutableMap.of(
55-
oldImageSK, attributeValueS_event,
56-
keyNK, attributeValueN_event
57-
))
58-
.withNewImage(ImmutableMap.of(
59-
newImageSK, attributeValueS_event,
60-
keyNK, attributeValueN_event
61-
))
62-
.withStreamViewType(StreamViewType.fromValue(streamViewType))
63-
.withSequenceNumber(sequenceNumber)
64-
.withSizeBytes(sizeBytes)
65-
.withApproximateCreationDateTime(approximateCreationDateTime);
40+
public static final com.amazonaws.services.lambda.runtime.events.models.dynamodb.StreamRecord streamRecord_event =
41+
new com.amazonaws.services.lambda.runtime.events.models.dynamodb.StreamRecord()
42+
.withKeys(ImmutableMap.<String, AttributeValue> builder()
43+
.put(keyNK, attributeValueN_event)
44+
.put(keyNSK, attributeValueNS_event)
45+
.put(keySK, attributeValueS_event)
46+
.put(keySSK, attributeValueSS_event)
47+
.put(keyBK, attributeValueB_event)
48+
.put(keyBSK, attributeValueBS_event)
49+
.put(keyBOOLK, attributeValueBOOL_event)
50+
.put(keyNULK, attributeValueNUL_event)
51+
.put(keyMK, attributeValueM_event)
52+
.put(keyLK, attributeValueL_event)
53+
.build()
54+
)
55+
.withOldImage(ImmutableMap.of(
56+
oldImageSK, attributeValueS_event,
57+
keyNK, attributeValueN_event
58+
))
59+
.withNewImage(ImmutableMap.of(
60+
newImageSK, attributeValueS_event,
61+
keyNK, attributeValueN_event
62+
))
63+
.withStreamViewType(StreamViewType.fromValue(streamViewType))
64+
.withSequenceNumber(sequenceNumber)
65+
.withSizeBytes(sizeBytes)
66+
.withApproximateCreationDateTime(approximateCreationDateTime);
6667
//endregion
6768

6869
//region StreamRecord_v2
6970
public static final StreamRecord streamRecord_v2 = StreamRecord.builder()
70-
.approximateCreationDateTime(approximateCreationDateTime.toInstant())
71-
.keys(ImmutableMap.<String, software.amazon.awssdk.services.dynamodb.model.AttributeValue> builder()
72-
.put(keyNK, attributeValueN_v2)
73-
.put(keyNSK, attributeValueNS_v2)
74-
.put(keySK, attributeValueS_v2)
75-
.put(keySSK, attributeValueSS_v2)
76-
.put(keyBK, attributeValueB_v2)
77-
.put(keyBSK, attributeValueBS_v2)
78-
.put(keyBOOLK, attributeValueBOOL_v2)
79-
.put(keyNULK, attributeValueNUL_v2)
80-
.put(keyMK, attributeValueM_v2)
81-
.put(keyLK, attributeValueL_v2)
82-
.build()
83-
)
84-
.oldImage(ImmutableMap.of(
85-
oldImageSK, attributeValueS_v2,
86-
keyNK, attributeValueN_v2
87-
))
88-
.newImage(ImmutableMap.of(
89-
newImageSK, attributeValueS_v2,
90-
keyNK, attributeValueN_v2
91-
))
92-
.sequenceNumber(sequenceNumber)
93-
.sizeBytes(sizeBytes)
94-
.streamViewType(streamViewType)
95-
.build();
71+
.approximateCreationDateTime(approximateCreationDateTime.toInstant())
72+
.keys(ImmutableMap.<String, software.amazon.awssdk.services.dynamodb.model.AttributeValue> builder()
73+
.put(keyNK, attributeValueN_v2)
74+
.put(keyNSK, attributeValueNS_v2)
75+
.put(keySK, attributeValueS_v2)
76+
.put(keySSK, attributeValueSS_v2)
77+
.put(keyBK, attributeValueB_v2)
78+
.put(keyBSK, attributeValueBS_v2)
79+
.put(keyBOOLK, attributeValueBOOL_v2)
80+
.put(keyNULK, attributeValueNUL_v2)
81+
.put(keyMK, attributeValueM_v2)
82+
.put(keyLK, attributeValueL_v2)
83+
.build()
84+
)
85+
.oldImage(ImmutableMap.of(
86+
oldImageSK, attributeValueS_v2,
87+
keyNK, attributeValueN_v2
88+
))
89+
.newImage(ImmutableMap.of(
90+
newImageSK, attributeValueS_v2,
91+
keyNK, attributeValueN_v2
92+
))
93+
.sequenceNumber(sequenceNumber)
94+
.sizeBytes(sizeBytes)
95+
.streamViewType(streamViewType)
96+
.build();
9697
//endregion
9798

9899
@Test

0 commit comments

Comments
 (0)