Skip to content

Commit 16533b0

Browse files
committed
Add S3BatchEventV2 class
1 parent 70467ba commit 16533b0

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package com.amazonaws.services.lambda.runtime.events;
2+
3+
import lombok.AllArgsConstructor;
4+
import lombok.Builder;
5+
import lombok.Data;
6+
import lombok.NoArgsConstructor;
7+
8+
import java.util.List;
9+
import java.util.Map;
10+
11+
/**
12+
* Event to represent the payload which is sent to Lambda by S3 Batch to perform a custom
13+
* action when using invocation schema version 2.0.
14+
*
15+
* https://docs.aws.amazon.com/AmazonS3/latest/dev/batch-ops-invoke-lambda.html
16+
*/
17+
18+
@Data
19+
@Builder(setterPrefix = "with")
20+
@NoArgsConstructor
21+
@AllArgsConstructor
22+
public class S3BatchEventV2 {
23+
24+
private String invocationSchemaVersion;
25+
private String invocationId;
26+
private Job job;
27+
private List<Task> tasks;
28+
29+
@Data
30+
@Builder(setterPrefix = "with")
31+
@NoArgsConstructor
32+
@AllArgsConstructor
33+
public static class Job {
34+
35+
private String id;
36+
private Map<String, String> userArguments;
37+
}
38+
39+
@Data
40+
@Builder(setterPrefix = "with")
41+
@NoArgsConstructor
42+
@AllArgsConstructor
43+
public static class Task {
44+
45+
private String taskId;
46+
private String s3Key;
47+
private String s3VersionId;
48+
private String s3BucketName;
49+
}
50+
}

aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/S3BatchResponse.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,10 @@ public static S3BatchResponseBuilder fromS3BatchEvent(S3BatchEvent s3BatchEvent)
6262
.withInvocationId(s3BatchEvent.getInvocationId())
6363
.withInvocationSchemaVersion(s3BatchEvent.getInvocationSchemaVersion());
6464
}
65-
}
65+
66+
public static S3BatchResponseBuilder fromS3BatchEvent(S3BatchEventV2 s3BatchEvent) {
67+
return S3BatchResponse.builder()
68+
.withInvocationId(s3BatchEvent.getInvocationId())
69+
.withInvocationSchemaVersion(s3BatchEvent.getInvocationSchemaVersion());
70+
}
71+
}

0 commit comments

Comments
 (0)