Skip to content

Commit 6e74852

Browse files
authored
Fix bug in s3 eventbridge notification where a new field was introduced (opensearch-project#6932)
Signed-off-by: Divyansh Bokadia <dbokadia@amazon.com>
1 parent 4818896 commit 6e74852

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

data-prepper-plugins/s3-source/src/main/java/org/opensearch/dataprepper/plugins/source/s3/S3EventBridgeNotification.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.opensearch.dataprepper.plugins.source.s3;
22

33
import com.fasterxml.jackson.annotation.JsonCreator;
4+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
45
import com.fasterxml.jackson.annotation.JsonProperty;
56
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
67
import org.joda.time.DateTime;
@@ -86,6 +87,7 @@ public Detail getDetail() {
8687
return detail;
8788
}
8889

90+
@JsonIgnoreProperties(ignoreUnknown = true)
8991
public static class Detail {
9092
private final String version;
9193
private final Bucket bucket;
@@ -94,6 +96,7 @@ public static class Detail {
9496
private final String requester;
9597
private final String sourceIpAddress;
9698
private final String reason;
99+
private final String eventVersion;
97100

98101
@JsonCreator
99102
public Detail(@JsonProperty(value = "version") final String version,
@@ -102,14 +105,16 @@ public Detail(@JsonProperty(value = "version") final String version,
102105
@JsonProperty("request-id") final String requestId,
103106
@JsonProperty("requester") final String requester,
104107
@JsonProperty("source-ip-address") final String sourceIpAddress,
105-
@JsonProperty("reason") final String reason) {
108+
@JsonProperty("reason") final String reason,
109+
@JsonProperty("event-version") final String eventVersion) {
106110
this.version = version;
107111
this.bucket = bucket;
108112
this.object = object;
109113
this.requestId = requestId;
110114
this.requester = requester;
111115
this.sourceIpAddress = sourceIpAddress;
112116
this.reason = reason;
117+
this.eventVersion = eventVersion;
113118
}
114119

115120
public String getVersion() {

data-prepper-plugins/s3-source/src/test/java/org/opensearch/dataprepper/plugins/source/s3/parser/S3EventBridgeNotificationParserTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class S3EventBridgeNotificationParserTest {
2626
"\"object\":{\"key\":\"example-key\",\"size\":5,\"etag\":\"b1946ac92492d2347c6235b4d2611184\"," +
2727
"\"version-id\":\"IYV3p45BT0ac8hjHg1houSdS1a.Mro8e\",\"sequencer\":\"617f08299329d189\"}," +
2828
"\"request-id\":\"N4N7GDK58NMKJ12R\",\"requester\":\"123456789012\",\"source-ip-address\":\"1.2.3.4\"," +
29-
"\"reason\":\"PutObject\"}}";
29+
"\"reason\":\"PutObject\",\"event-version\":\"1.0\"}}";
3030

3131
private final String SECURITY_LAKE_MESSAGE = "{\"source\":\"aws.s3\",\"time\":\"2021-11-12T00:00:00Z\",\"account\":\"123456789012\",\"region\":\"ca-central-1\"," +
3232
"\"resources\":[\"arn:aws:s3:::example-bucket\"],\"detail\":{\"bucket\":{\"name\":\"example-bucket\"}," +

0 commit comments

Comments
 (0)