0

以下是我编写的部分代码:

S3Object obj1 = null; obj1 = s3client.getObject("bucketname", "file.yml"); 
S3ObjectInputStream instream = obj1.getObjectContent ();

将代码部署到 openfaas 时出现以下错误:

错误:不兼容的类型:InputStream 无法转换为 S3ObjectInputStream S3ObjectInputStream instream = obj1.getObjectContent ();

4

1 回答 1

0

So I don't know a lot about AWS (yet), but reading the specification for the S3Client, your declaration is possibly incorrect, as there does not seem to be an implementation of S3Client.getObject() that supports two String inputs. Instead it's looking for a GetObjectRequest (namely S3Client.getObject(GetObjectRequest getObjectRequest))

So your implementation may have to be something as follows:

S3Object s3Object = s3client.getObject(new GetObjectRequest(bucket, key))

Here's an example : Amazon.S3.Model.GetObjectRequest

于 2019-10-02T11:44:23.420 回答