Пример #1
0
        public IEnumerable <Ds3Object> ListObjects(string bucketName, string keyPrefix)
        {
            var    isTruncated = false;
            string marker      = null;

            do
            {
                var request = new Ds3.Calls.GetBucketRequest(bucketName)
                {
                    Marker = marker,
                    Prefix = keyPrefix
                };
                var response = _client.GetBucket(request);
                isTruncated = response.IsTruncated;
                marker      = response.NextMarker;
                var responseObjects = response.Objects as IList <Ds3ObjectInfo> ?? response.Objects.ToList();
                foreach (var ds3Object in responseObjects)
                {
                    yield return(ds3Object);
                }
            } while (isTruncated);
        }
Пример #2
0
 public GetBucketResponse GetBucket(GetBucketRequest request)
 {
     return new GetBucketResponseParser().Parse(request, _netLayer.Invoke(request));
 }
 public void Test0520GetBadBucket()
 {
     var request = new Ds3.Calls.GetBucketRequest("NoBucket" + DateTime.Now.Ticks);
        _client.GetBucket(request);
 }
 public void TestGetBadBucket()
 {
     var request = new GetBucketRequest("NoBucket" + DateTime.Now.Ticks);
     Assert.Throws<Ds3BadStatusCodeException>(() => _client.GetBucket(request));
 }