什么是 Lambda S3Event 的 AWS SDK V2 类? [英] What's the AWS SDK V2 class for Lambda S3Event?

查看:16
本文介绍了什么是 Lambda S3Event 的 AWS SDK V2 类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于 Java SDK V1,我有一个这样的 lambda 函数:

For the Java SDK V1, I have a lambda function like this:

public static void doSomethingLambda(S3Event s3Event) throws Exception {
    s3Event....

但是在 SDK V2 中,S3Event 似乎不存在.除非我使用了错误的依赖项?(V2 的文档非常稀少)

however in SDK V2, S3Event does not seem to exist. Unless I am using the wrong dependency? (The docs for V2 are pretty sparse)

这是我的 SDK V1 依赖项:

Here is my SDK V1 Dependencies:

  <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-lambda-java-events</artifactId>
        <version>1.3.0</version>
    </dependency>

    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk-s3</artifactId>
        <version>1.11.534</version>
    </dependency>

和 SDK V2:

 <dependency>
        <groupId>software.amazon.awssdk</groupId>
        <artifactId>s3</artifactId>
    </dependency>
    <dependency>
        <groupId>software.amazon.awssdk</groupId>
        <artifactId>lambda</artifactId>
    </dependency>

推荐答案

根据 5 月 18 日针对 aws lambda java libs 到 aws sdk java v2

According to the resolution provided on 18 May for aws lambda java libs to aws sdk java v2

aws-lambda-java-events version 3.0.0 was just released with support for all events (including S3) without the inclusion of SDK v1 dependencies.
This should help you make use of the AWS SDK for Java v2 and reduce your function package size as the v1 SDK does not need to be bundled anymore if it's not explicitly needed.

源代码在这里

这篇关于什么是 Lambda S3Event 的 AWS SDK V2 类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆