예제 #1
0
        async Task Fetch()
        {
            var isEmpty = false;

            while (!isEmpty)
            {
                LogInfo("Downloading from " + Account.S3Bucket);
                var request = new Amazon.S3.Model.ListObjectsV2Request {
                    BucketName = Account.S3Bucket
                };
                var response = await S3Client.ListObjectsV2Async(request);

                LogInfo($"Downloaded {response.S3Objects.Count} items from " + Account.S3Bucket);

                foreach (var item in response.S3Objects)
                {
                    await Fetch(item);
                }


                Log.For(this).Info($"Downloaded {response.S3Objects.Count} items from " + Account.S3Bucket);

                isEmpty = response.NextContinuationToken.IsEmpty();

                if (isEmpty)
                {
                    Log.For("Downloaded all the objects from " + Account.S3Bucket);
                    break;
                }
            }
        }