AWSSDK_DotNet.IntegrationTests.Tests.S3.S3TestUtils.WaitForObject C# (CSharp) Method

WaitForObject() public static method

public static WaitForObject ( IAmazonS3 client, string bucketName, string key, int maxSeconds ) : void
client IAmazonS3
bucketName string
key string
maxSeconds int
return void
        public static void WaitForObject(IAmazonS3 client, string bucketName, string key, int maxSeconds)
        {
            var sleeper = new UtilityMethods.ListSleeper(500, 1000, 2000, 5000);
            UtilityMethods.WaitUntilSuccess(() => { client.GetObject(bucketName, key); }, sleeper, 30);
        }
    }

Usage Example

        private string CreateBucketAndObject(AmazonS3Client client)
        {
            var bucketName = S3TestUtils.CreateBucketWithWait(client);

            client.PutObject(new PutObjectRequest
            {
                BucketName  = bucketName,
                Key         = TestKey,
                ContentBody = TestContent
            });
            S3TestUtils.WaitForObject(client, bucketName, TestKey, 30);
            return(bucketName);
        }