Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3 Event Notifications parsers #4994

Merged
merged 29 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2788880
s3-event-notifications new module
L-Applin Mar 5, 2024
0ebbd61
fix pom.xml
L-Applin Mar 5, 2024
58fdfbd
Equals, hashcode, tostring. More tests. Remove Entity suffix.
L-Applin Mar 6, 2024
cafd7db
handle null fields
L-Applin Mar 6, 2024
40c0dc5
Checkstyle
L-Applin Mar 6, 2024
7279f14
changelog
L-Applin Mar 6, 2024
966b54a
new module checklist
L-Applin Mar 6, 2024
bcf053a
readme, extra fields, cleanup
L-Applin Mar 6, 2024
084c26f
Merge branch 'master' into olapplin/s3-event-notifications
L-Applin Mar 6, 2024
e675f43
remove duplicate dependency
L-Applin Mar 6, 2024
8ddc4a7
Merge branch 'master' into olapplin/s3-event-notifications
L-Applin Mar 6, 2024
1817363
update pom version
L-Applin Mar 6, 2024
ab0772c
Merge remote-tracking branch 'origin/olapplin/s3-event-notifications'…
L-Applin Mar 6, 2024
b857f39
update pom version, for real this time
L-Applin Mar 6, 2024
6b09103
fix pom
L-Applin Mar 7, 2024
2833c78
cleanup
L-Applin Mar 7, 2024
bba4278
documentation
L-Applin Mar 7, 2024
832cd86
PR comments
L-Applin Mar 8, 2024
639a429
Merge branch 'master' into olapplin/s3-event-notifications
L-Applin Mar 8, 2024
8c7bc7c
update pom, again
L-Applin Mar 8, 2024
41ef25b
Merge remote-tracking branch 'origin/olapplin/s3-event-notifications'…
L-Applin Mar 8, 2024
d67ef05
PR comment:
L-Applin Mar 8, 2024
0677e9a
Suppress non-final fields in EqualsVerifier test.
L-Applin Mar 11, 2024
2a9e585
Merge branch 'master' into olapplin/s3-event-notifications
L-Applin Mar 11, 2024
1726d40
update pom to 2.25.7-SNAPSHOT
L-Applin Mar 11, 2024
5c10d19
make S3EventNotificationRecord test constructor package-protected
L-Applin Mar 11, 2024
3813c10
Merge branch 'master' into olapplin/s3-event-notifications
L-Applin Mar 13, 2024
d2bf9f9
Merge branch 'master' into olapplin/s3-event-notifications
L-Applin Mar 15, 2024
19a0c97
maven version
L-Applin Mar 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .brazil.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"protocol-core": { "packageName": "AwsJavaSdk-Core-ProtocolCore" },
"regions": { "packageName": "AwsJavaSdk-Core-Regions" },
"s3-transfer-manager": { "packageName": "AwsJavaSdk-S3-TransferManager" },
"s3-event-notifications": { "packageName": "AwsJavaSdk-S3-EventNotifications" },
"sdk-core": { "packageName": "AwsJavaSdk-Core" },
"url-connection-client": { "packageName": "AwsJavaSdk-HttpClient-UrlConnectionClient" },
"utils": { "packageName": "AwsJavaSdk-Core-Utils" },
Expand Down
6 changes: 6 additions & 0 deletions .changes/next-release/feature-AWSSDKforJavav2-10ff57d.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "feature",
"category": "AWS SDK for Java v2",
"contributor": "",
"description": "Add the model for S3 Event Notifications and json parsers for them"
}
5 changes: 5 additions & 0 deletions aws-sdk-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,11 @@ Amazon AutoScaling, etc).</description>
<artifactId>s3-transfer-manager</artifactId>
<version>${awsjavasdk.version}</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3-event-notifications</artifactId>
<version>${awsjavasdk.version}</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sagemaker</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@
<artifactId>s3-transfer-manager</artifactId>
<version>${awsjavasdk.version}</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3-event-notifications</artifactId>
<version>${awsjavasdk.version}</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-crt-client</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public JsonWriter writeEndArray() {
}

public JsonWriter writeNull() {
return unsafeWrite(generator::writeEndArray);
return unsafeWrite(generator::writeNull);
}

public JsonWriter writeStartObject() {
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,7 @@
<includeModule>dynamodb-enhanced</includeModule>
<includeModule>s3-transfer-manager</includeModule>
<includeModule>iam-policy-builder</includeModule>
<includeModule>s3-event-notifications</includeModule>

<!-- Service modules that are heavily customized should be included -->
<includeModule>s3</includeModule>
Expand Down
1 change: 1 addition & 0 deletions services-custom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<module>dynamodb-enhanced</module>
<module>s3-transfer-manager</module>
<module>iam-policy-builder</module>
<module>s3-event-notifications</module>
</modules>

<dependencyManagement>
Expand Down
36 changes: 36 additions & 0 deletions services-custom/s3-event-notifications/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# S3 Event Notifications

## Overview

This module contains the classes used to represent Amazon S3 Event Notifications.


## Deserialization

To convert a json notification to java classes, use the static methods
available on `S3EventNotification`:

```java
String json = "..."; // the notification as json
S3EventNotification event = S3EventNotification.fromJson(json);
event.getRecords().forEach(rec -> println(rec.toString()));
```

Any missing fields of the json will be null in the resulting object.
Any extra fields will be ignored.


## Serialization

To convert an instance of `S3EventNotification` to json, use the `.toJson()`
or `toJsonPretty()` method:

```java
S3EventNotification event = new S3EventNotification(...);
String json = event.toJson();
String jsonPretty = event.toJsonPretty();
```

`GlacierEventData`, `ReplicationEventData`, `IntelligentTieringEventData` and `LifecycleEventData`
will be excluded from the json if null. Any other null fields of the object will be
serialized in the json as `null`.
L-Applin marked this conversation as resolved.
Show resolved Hide resolved
111 changes: 111 additions & 0 deletions services-custom/s3-event-notifications/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License").
~ You may not use this file except in compliance with the License.
~ A copy of the License is located at
~
~ http://aws.amazon.com/apache2.0
~
~ or in the "license" file accompanying this file. This file is distributed
~ on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
~ express or implied. See the License for the specific language governing
~ permissions and limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-sdk-java-pom</artifactId>
<version>2.25.6-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>s3-event-notifications</artifactId>
<name>AWS Java SDK :: S3 :: Event Notification</name>
<description>
The AWS SDK for Java - S3 Even Notification contains POJO classes and utils method to help serialize and
deserialize Amazon S3 Event Notifications.
</description>

<properties>
<jre.version>1.8</jre.version>
<awsjavasdk.version>${project.parent.version}</awsjavasdk.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom-internal</artifactId>
<version>${awsjavasdk.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>third-party-jackson-core</artifactId>
<version>${awsjavasdk.version}</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>json-utils</artifactId>
<version>${awsjavasdk.version}</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>annotations</artifactId>
<version>${awsjavasdk.version}</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>utils</artifactId>
<version>${awsjavasdk.version}</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>software.amazon.awssdk.eventnotifications.s3</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>

</project>
Loading
Loading