private GetPublicAccessBlockResponse Call_GetPublicAccessBlock(IAmazonS3 client, string bucketName, PublicAccessBlockConfiguration expectedConfiguration) { var getRequest = new GetPublicAccessBlockRequest { BucketName = bucketName }; GetPublicAccessBlockResponse getResponse = null; var sleeper = new UtilityMethods.ListSleeper(500, 1000, 2000, 5000, 10000, 15000); UtilityMethods.WaitUntil(() => { getResponse = client.GetPublicAccessBlock(getRequest); if (expectedConfiguration == null) { //If expectedConfiguration is null then we want GetPublicAccessBlock to throw an exception because the configuration was removed. //Wait until the configuration was removed / until an exception is thrown. return(false); } return(getResponse.HttpStatusCode == HttpStatusCode.OK && expectedConfiguration.BlockPublicAcls == getResponse.PublicAccessBlockConfiguration.BlockPublicAcls && expectedConfiguration.BlockPublicPolicy == getResponse.PublicAccessBlockConfiguration.BlockPublicPolicy && expectedConfiguration.IgnorePublicAcls == getResponse.PublicAccessBlockConfiguration.IgnorePublicAcls && expectedConfiguration.RestrictPublicBuckets == getResponse.PublicAccessBlockConfiguration.RestrictPublicBuckets); }, sleeper, 30); Assert.AreEqual(true, getResponse != null && getResponse.HttpStatusCode == HttpStatusCode.OK); Assert.AreEqual(expectedConfiguration.BlockPublicAcls, getResponse.PublicAccessBlockConfiguration.BlockPublicAcls); Assert.AreEqual(expectedConfiguration.BlockPublicPolicy, getResponse.PublicAccessBlockConfiguration.BlockPublicPolicy); Assert.AreEqual(expectedConfiguration.IgnorePublicAcls, getResponse.PublicAccessBlockConfiguration.IgnorePublicAcls); Assert.AreEqual(expectedConfiguration.RestrictPublicBuckets, getResponse.PublicAccessBlockConfiguration.RestrictPublicBuckets); return(getResponse); }
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); }
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); }
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); }