Skip to content

Commit f98bdc9

Browse files
carlzoghraupachz
authored andcommitted
Update SDK Transformer for events v3.0.0, bump to 2.0.0 (aws#132)
* Update `aws-lambda-java-events` to version `3.0.0` in transformer lib, bump to `2.0.0` * Bump DynamoDB SDK to version 2.13.18 * Bump SDK Transformer lib to version 2.0.0
1 parent b1068fd commit f98bdc9

File tree

9 files changed

+79
-84
lines changed

9 files changed

+79
-84
lines changed

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,27 @@ 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>
3333
<dependency>
3434
<groupId>software.amazon.awssdk</groupId>
3535
<artifactId>dynamodb</artifactId>
36-
<version>2.11.12</version>
37-
</dependency>
38-
<dependency>
39-
<groupId>com.amazonaws</groupId>
40-
<artifactId>aws-java-sdk-dynamodb</artifactId>
41-
<version>1.11.163</version>
36+
<version>2.13.18</version>
4237
</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
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
- Bump `software.amazon.awssdk:dynamodb` to version `2.13.18`
5+
16
### Apr 29, 2020
27
`1.0.0`:
38
- 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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.amazonaws</groupId>
77
<artifactId>aws-lambda-java-events-sdk-transformer</artifactId>
8-
<version>1.0.0</version>
8+
<version>2.0.0</version>
99
<packaging>jar</packaging>
1010

1111
<name>AWS Lambda Java Events SDK Transformer Library</name>
@@ -49,19 +49,13 @@
4949
<dependency>
5050
<groupId>software.amazon.awssdk</groupId>
5151
<artifactId>dynamodb</artifactId>
52-
<version>2.11.12</version>
53-
<scope>provided</scope>
54-
</dependency>
55-
<dependency>
56-
<groupId>com.amazonaws</groupId>
57-
<artifactId>aws-java-sdk-dynamodb</artifactId>
58-
<version>1.11.163</version>
52+
<version>2.13.18</version>
5953
<scope>provided</scope>
6054
</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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 7 additions & 6 deletions
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

Lines changed: 55 additions & 54 deletions
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)