Exemplo n.º 1
0
        /// <inheritdoc />
        public async Task <IEnumerable <string> > ListAsync(StorageListOptions options, CancellationToken cancellationToken = default)
        {
            ValidateFileName(options.Container);

            _logger.LogDebug("Listing contents of container {Container}", options.Container);

            var request = new ListObjectsV2Request
            {
                Prefix     = $"{options.Container}/",
                BucketName = _bucketName
            };

            ListObjectsV2Response response;
            var results = new List <string>();

            do
            {
                response = await _client.ListObjectsV2Async(request, cancellationToken);

                request.ContinuationToken = response.NextContinuationToken;

                results.AddRange(response.S3Objects.Select(r => r.Key));
            } while (response.IsTruncated);

            return(results);
        }
Exemplo n.º 2
0
        /// <inheritdoc />
        public Task <IEnumerable <string> > ListAsync(StorageListOptions options, CancellationToken cancellationToken = default)
        {
            ValidateFileName(options.Container);

            _logger.LogDebug("Listing contents of container {Container}", options.Container);

            return(Task.FromResult(
                       Directory.GetFiles(GetContainerLocation(options.Container)).AsEnumerable()));
        }
Exemplo n.º 3
0
 /// <inheritdoc />
 public Task <IEnumerable <string> > ListAsync(StorageListOptions options, CancellationToken cancellationToken = default)
 {
     return(Task.FromResult(_contents.Keys
                            .Where(x => x.StartsWith($"{options.Container}/"))));
 }