如何列出亚马逊S3存储桶_all_对象? [英] How to list _all_ objects in Amazon S3 bucket?

查看:521
本文介绍了如何列出亚马逊S3存储桶_all_对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

S3Client.ListObjects只返回对象1000。如何检索所有现有对象列表使用亚马逊的C#库?

S3Client.ListObjects return only 1000 of objects. How to retrieve list of all existing objects using Amazon C# library?

推荐答案

如前所述已,亚马逊S3 中确实需要<一个HREF =htt​​p://docs.aws.amazon.com/AmazonS3/latest/dev/ListingObjectKeysUsingNetSDK.html>上市键使用AWS SDK的.NET :

As stated already, Amazon S3 indeed requires Listing Keys Using the AWS SDK for .NET:

如水桶可含有几乎无限数量的键,所述的   清单查询的完整结果可能会非常大。去管理   大结果集,Amazon S3使用分页它们分割成   多个响应。每个列表按键响应返回最多的页面   1000按键与指示灯,指示响应将被截断。   你送了一系列的列表项的请求,直到你接收到的所有   的键。

As buckets can contain a virtually unlimited number of keys, the complete results of a list query can be extremely large. To manage large result sets, Amazon S3 uses pagination to split them into multiple responses. Each list keys response returns a page of up to 1,000 keys with an indicator indicating if the response is truncated. You send a series of list keys requests until you have received all the keys.

所提到的指标是<一个href="http://docs.amazonwebservices.com/sdkfornet/latest/apidocs/html/P_Amazon_S3_Model_ListObjectsResponse_NextMarker.htm">NextMarker从<属性href="http://docs.amazonwebservices.com/sdkfornet/latest/apidocs/html/T_Amazon_S3_Model_ListObjectsResponse.htm">ObjectsResponse类 - 它的使用说明在完整的例子<一href="http://docs.amazonwebservices.com/AmazonS3/latest/dev/ListingObjectKeysUsingNetSDK.html">Listing按键使用AWS SDK的.NET ,相关片段的存在:

The mentioned indicator is the NextMarker property from the ObjectsResponse Class - its usage is illustrated in the complete example Listing Keys Using the AWS SDK for .NET, with the relevant fragment being:

static AmazonS3 client;
client = Amazon.AWSClientFactory.CreateAmazonS3Client(
                    accessKeyID, secretAccessKeyID);

ListObjectsRequest request = new ListObjectsRequest();
request.BucketName = bucketName;
do
{
   ListObjectsResponse response = client.ListObjects(request);

   // Process response.
   // ...

   // If response is truncated, set the marker to get the next 
   // set of keys.
   if (response.IsTruncated)
   {
        request.Marker = response.NextMarker;
   }
   else
   {
        request = null;
   }
} while (request != null);

这篇关于如何列出亚马逊S3存储桶_all_对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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