Beispiel #1
0
        public async Task <IReadOnlyDictionary <string, string> > GetPropertiesAsync(string key)
        {
            int       retryCount = 0;
            Exception lastException;

            do
            {
                if (retryCount > 0)
                {
                    await Task.Delay(retryPolicy.GetDelay(retryCount)).ConfigureAwait(false);
                }

                try
                {
                    var request = new ObjectHeadRequest(client.Host, bucketName, key);

                    using var result = await client.GetObjectHeadAsync(request).ConfigureAwait(false);

                    return(result.Properties);
                }
                catch (S3Exception ex) when(ex.IsTransient)
                {
                    lastException = ex;
                }

                retryCount++;
            }while (retryPolicy.ShouldRetry(retryCount));

            throw lastException;
        }
Beispiel #2
0
        public async Task <IReadOnlyDictionary <string, string> > GetPropertiesAsync(string key)
        {
            var request = new ObjectHeadRequest(client.Host, bucketName, key: key);

            using var result = await client.GetObjectHeadAsync(request).ConfigureAwait(false);

            return(result.Properties !);
        }
Beispiel #3
0
        public async Task <IReadOnlyDictionary <string, string> > GetMetadataAsync(string name)
        {
            var headRequest = new ObjectHeadRequest(client.Region, bucketName, key: name);

            var result = await client.GetObjectHeadAsync(headRequest).ConfigureAwait(false);

            return(result.Headers);
        }
Beispiel #4
0
 public async Task <S3ObjectInfo> GetObjectHeadAsync(ObjectHeadRequest request)
 {
     using (var response = await SendAsync2(request).ConfigureAwait(false))
     {
         return(new S3ObjectInfo(
                    bucketName: request.BucketName,
                    name: request.ObjectName,
                    response: response
                    ));
     }
 }
Beispiel #5
0
        public async Task <IReadOnlyDictionary <string, string> > GetMetadataAsync(string name)
        {
            #region Preconditions

            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            #endregion

            var request = new ObjectHeadRequest(client.Host, bucketName, key: name);

            var result = await client.GetObjectHeadAsync(request).ConfigureAwait(false);

            return(result.Metadata);
        }
Beispiel #6
0
        public async Task <S3ObjectInfo> GetObjectHeadAsync(ObjectHeadRequest request)
        {
            using var response = await SendAsync2(request, request.CompletionOption).ConfigureAwait(false);

            return(S3ObjectInfo.FromResponse(request.BucketName, request.ObjectName !, response));
        }
Beispiel #7
0
        public async Task <S3ObjectInfo> GetObjectHeadAsync(ObjectHeadRequest request, CancellationToken cancelationToken = default)
        {
            using var response = await SendAsync2(request, HttpCompletionOption.ResponseHeadersRead, cancelationToken).ConfigureAwait(false);

            return(S3ObjectInfo.FromResponse(request.BucketName, request.ObjectName !, response));
        }