亚马逊 s3 对象按日期过滤 [英] Amazon s3 object filter by date

查看:50
本文介绍了亚马逊 s3 对象按日期过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要按上次修改日期过滤存储桶内的 s3 对象

I need to filter s3 objects inside a bucket by last modified date

BasicAWSCredentials awsCreds = new BasicAWSCredentials(accessKey, secretKey);
            AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
                    .withCredentials(new AWSStaticCredentialsProvider(awsCreds)).withRegion(Regions.US_EAST_2).build();
ListObjectsV2Result result = s3Client.listObjectsV2(bucketName, date);
                List<S3ObjectSummary> objects = result.getObjectSummaries();
List<S3ObjectSummary> objects = result.getObjectSummaries(); //contains objects

这里在 s3 中,我有一个存储桶.在存储桶内,将有带有日期的文件夹.特定日期的数据累积到相应的日期文件夹中.在日期文件夹中,有 JSON 对象和修改日期.我想获取具有日期范围的 json 对象.

Here In s3, I have a bucket. Inside the bucket, there will be the folder with dates. The data for the particular date accumulated to the corresponding date folder. Inside the date folder, JSON objects and modified date is there.I want to fetch the json objects with date range.

推荐答案

S3 不支持检索按日期过滤的对象列表.

S3 does not support retrieving an object listing filtered by date.

正如@John 上面提到的,您需要遍历列表并评估代码中的过滤条件.

As @John noted above, you will need to iterate through the listing and evaluate the filter condition in your code.

这篇关于亚马逊 s3 对象按日期过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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