Skip to content

Remove SDK dependencies from events library #127

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

Merged
merged 6 commits into from
May 18, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ___
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-events</artifactId>
<version>2.2.8</version>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
Expand All @@ -58,7 +58,7 @@ ___

```groovy
'com.amazonaws:aws-lambda-java-core:1.2.1'
'com.amazonaws:aws-lambda-java-events:2.2.8'
'com.amazonaws:aws-lambda-java-events:3.0.0'
'com.amazonaws:aws-lambda-java-events-sdk-transformer:1.0.0'
'com.amazonaws:aws-lambda-java-log4j:1.0.1'
'com.amazonaws:aws-lambda-java-log4j2:1.2.0'
Expand All @@ -68,7 +68,7 @@ ___

```clojure
[com.amazonaws/aws-lambda-java-core "1.2.1"]
[com.amazonaws/aws-lambda-java-events "2.2.8"]
[com.amazonaws/aws-lambda-java-events "3.0.0"]
[com.amazonaws/aws-lambda-java-events-sdk-transformer "1.0.0"]
[com.amazonaws/aws-lambda-java-log4j "1.0.1"]
[com.amazonaws/aws-lambda-java-log4j2 "1.2.0"]
Expand All @@ -78,7 +78,7 @@ ___

```scala
"com.amazonaws" % "aws-lambda-java-core" % "1.2.1"
"com.amazonaws" % "aws-lambda-java-events" % "2.2.8"
"com.amazonaws" % "aws-lambda-java-events" % "3.0.0"
"com.amazonaws" % "aws-lambda-java-events-sdk-transformer" % "1.0.0"
"com.amazonaws" % "aws-lambda-java-log4j" % "1.0.1"
"com.amazonaws" % "aws-lambda-java-log4j2" % "1.2.0"
Expand Down
148 changes: 43 additions & 105 deletions aws-lambda-java-events/README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,36 @@
# AWS Lambda Java Events v2.0
# AWS Lambda Java Events v3.0

### New Event Models Supported
* APIGatewayProxyRequestEvent
* APIGatewayProxyResponseEvent
* APIGatewayV2ProxyRequestEvent
* APIGatewayV2ProxyResponseEvent
* CloudFrontEvent
* CloudWatchLogsEvent
* CodeCommitEvent
* IoTButtonEvent
* KinesisFirehoseEvent
* LexEvent
* ScheduledEvent
### Event Models Supported
* `APIGatewayProxyRequestEvent`
* `APIGatewayProxyResponseEvent`
* `APIGatewayV2ProxyRequestEvent`
* `APIGatewayV2ProxyResponseEvent`
* `CloudFrontEvent`
* `CloudWatchLogsEvent`
* `CodeCommitEvent`
* `CognitoEvent`
* `ConfigEvent`
* `DynamodbEvent`
* `IoTButtonEvent`
* `KinesisAnalyticsFirehoseInputPreprocessingEvent`
* `KinesisAnalyticsInputPreprocessingResponse`
* `KinesisAnalyticsOutputDeliveryEvent`
* `KinesisAnalyticsOutputDeliveryResponse`
* `KinesisAnalyticsStreamsInputPreprocessingEvent`
* `KinesisEvent`
* `KinesisFirehoseEvent`
* `LexEvent`
* `S3Event`
* `ScheduledEvent`
* `SNSEvent`
* `SQSEvent`

### New package inclusion model
The old package inclusion model required users to pull unused dependencies into
their package. We have removed this inclusion so that users' jars will be
smaller, which will results in reduced latency times. Customers using older
versions do not need to make any changes to their existing code.
*As of version `3.0.0`, users are no longer required to pull in SDK dependencies in order to use this library.*

The following event models do not require any SDK dependencies
* APIGatewayProxyRequestEvent
* APIGatewayProxyResponseEvent
* APIGatewayV2ProxyRequestEvent
* APIGatewayV2ProxyResponseEvent
* CloudFrontEvent
* CloudWatchLogsEvent
* CodeCommitEvent
* CognitoEvent
* ConfigEvent
* IoTButtonEvent
* KinesisFirehoseEvent
* LexEvent
* ScheduledEvent
* SNSEvent

so the dependencies section in the pom.xml file would like this
### Getting Started

[Maven](https://maven.apache.org)

```xml
<dependencies>
Expand All @@ -48,86 +43,29 @@ so the dependencies section in the pom.xml file would like this
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-events</artifactId>
<version>2.2.9</version>
<version>3.0.0</version>
</dependency>
...
</dependencies>
```

#### S3 Event

For the S3 event the pom would look like this:
[Gradle](https://gradle.org)

```xml
<dependencies>
...
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-core</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-events</artifactId>
<version>2.2.9</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.11.163</version>
</dependency>
...
</dependencies>
```groovy
'com.amazonaws:aws-lambda-java-core:1.2.1'
'com.amazonaws:aws-lambda-java-events:3.0.0'
```

#### Kinesis Event

For the Kinesis event
[Leiningen](http://leiningen.org) and [Boot](http://boot-clj.com)

```xml
<dependencies>
....
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-core</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-events</artifactId>
<version>2.2.9</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-kinesis</artifactId>
<version>1.11.163</version>
</dependency>
...
</dependencies>
```clojure
[com.amazonaws/aws-lambda-java-core "1.2.1"]
[com.amazonaws/aws-lambda-java-events "3.0.0"]
```

#### Dynamodb Event

For the Dynamodb event
[sbt](http://www.scala-sbt.org)

```xml
<dependencies>
...
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-core</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-events</artifactId>
<version>2.2.9</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-dynamodb</artifactId>
<version>1.11.163</version>
</dependency>
...
</dependencies>
```
```scala
"com.amazonaws" % "aws-lambda-java-core" % "1.2.1"
"com.amazonaws" % "aws-lambda-java-events" % "3.0.0"
```
17 changes: 17 additions & 0 deletions aws-lambda-java-events/RELEASE.CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
### Upcoming
`3.0.0`:
- Removed AWS SDK v1 dependencies ([#74](https://github.com/aws/aws-lambda-java-libs/issues/74))
- Copied relevant S3, Kinesis and DynamoDB model classes under namespace `com.amazonaws.services.lambda.runtime.events.models`
- S3:
- `S3EventNotification`
- Kinesis:
- `EncryptionType`
- `Record`
- DynamoDB:
- `AttributeValue`
- `Identity`
- `OperationType`
- `Record`
- `StreamRecord`
- `StreamViewType`

### May 13, 2020
`2.2.9`:
- Added field `operationName` to `APIGatewayProxyRequestEvent` ([#126](https://github.com/aws/aws-lambda-java-libs/pull/126))
Expand Down
23 changes: 6 additions & 17 deletions aws-lambda-java-events/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-events</artifactId>
<version>2.2.9</version>
<version>3.0.0</version>
<packaging>jar</packaging>

<name>AWS Lambda Java Events Library</name>
Expand Down Expand Up @@ -49,23 +49,12 @@
<artifactId>joda-time</artifactId>
<version>2.6</version>
</dependency>

<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.11.163</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-kinesis</artifactId>
<version>1.11.163</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-dynamodb</artifactId>
<version>1.11.163</version>
<scope>provided</scope>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.5.2</version>
<scope>test</scope>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
/* Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. */

/*
* Copyright 2015-2020 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.
*/
package com.amazonaws.services.lambda.runtime.events;

import com.amazonaws.services.dynamodbv2.model.Record;

import java.io.Serializable;
import java.util.List;

Expand All @@ -19,7 +27,7 @@ public class DynamodbEvent implements Serializable, Cloneable {
/**
* The unit of data of an Amazon DynamoDB event
*/
public static class DynamodbStreamRecord extends Record {
public static class DynamodbStreamRecord extends com.amazonaws.services.lambda.runtime.events.models.dynamodb.Record {

private static final long serialVersionUID = 3638381544604354963L;

Expand Down Expand Up @@ -52,7 +60,7 @@ public void setEventSourceARN(String eventSourceARN) {
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
* @see Object#toString()
*/
@Override
public String toString() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
/* Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. */

/*
* Copyright 2015-2020 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.
*/
package com.amazonaws.services.lambda.runtime.events;

import java.io.Serializable;
import java.util.List;

Expand All @@ -16,7 +27,7 @@ public class KinesisEvent implements Serializable, Cloneable {
/**
* The unit of data of an Amazon Kinesis stream
*/
public static class Record extends com.amazonaws.services.kinesis.model.Record {
public static class Record extends com.amazonaws.services.lambda.runtime.events.models.kinesis.Record {

private static final long serialVersionUID = 7856672931457425976L;

Expand Down Expand Up @@ -49,7 +60,7 @@ public void setKinesisSchemaVersion(String kinesisSchemaVersion) {
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
* @see Object#toString()
*/
@Override
public String toString() {
Expand Down Expand Up @@ -109,7 +120,7 @@ public boolean equals(Object obj) {
}

/* (non-Javadoc)
* @see com.amazonaws.services.kinesis.model.Record#hashCode()
* @see com.amazonaws.services.lambda.runtime.events.models.kinesis.Record#hashCode()
*/
@Override
public int hashCode() {
Expand Down Expand Up @@ -288,7 +299,7 @@ public void setAwsRegion(String awsRegion) {
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
* @see Object#toString()
*/
@Override
public String toString() {
Expand Down Expand Up @@ -413,7 +424,7 @@ public void setRecords(List<KinesisEventRecord> records) {
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
* @see Object#toString()
*/
@Override
public String toString() {
Expand Down
Loading