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

WaitForBucket() public static method

public static WaitForBucket ( IAmazonS3 client, string bucketName, int maxSeconds ) : void
client IAmazonS3
bucketName string
maxSeconds int
return void
        public static void WaitForBucket(IAmazonS3 client, string bucketName, int maxSeconds)
        {
            var sleeper = new UtilityMethods.ListSleeper(500, 1000, 2000, 5000);
            UtilityMethods.WaitUntil(()=> { return AmazonS3Util.DoesS3BucketExist(client, bucketName); }, sleeper, 30);
        }

Usage Example

        private static string GetOrCreateBucket(AmazonS3Client s3Client)
        {
            foreach (var bucket in s3Client.ListBuckets().Buckets)
            {
                if (bucket.BucketName.StartsWith(InteropBucketRoot))
                {
                    return(bucket.BucketName);
                }
            }

            var newBucketName = InteropBucketRoot + DateTime.UtcNow.ToFileTime();

            s3Client.PutBucket(newBucketName);
            S3TestUtils.WaitForBucket(s3Client, newBucketName);
            return(newBucketName);
        }
All Usage Examples Of AWSSDK_DotNet.IntegrationTests.Tests.S3.S3TestUtils::WaitForBucket