public void TestNonS3EndpointDetection() { string[] thirdPartyProviderUriExamples = { "http://storage.googleapis.com", "http://bucket.storage.googleapis.com", }; string[] s3UriExamples = { "http://s3.amazonaws.com", "http://s3-external-1.amazonaws.com", "http://s3-us-west-2.amazonaws.com", "http://bucketname.s3-us-west-2.amazonaws.com", "http://s3.eu-central-1.amazonaws.com", "http://bucketname.s3.eu-central-1.amazonaws.com", }; foreach (var uri in thirdPartyProviderUriExamples) { Assert.IsFalse(AmazonS3Uri.IsAmazonS3Endpoint(uri)); } foreach (var uri in s3UriExamples) { Assert.IsTrue(AmazonS3Uri.IsAmazonS3Endpoint(uri)); } }
internal static void EvaluateIfSigV4Required(IRequest request) { if (request.get_OriginalRequest() is GetObjectRequest && AmazonS3Uri.IsAmazonS3Endpoint(request.get_Endpoint()) && new AmazonS3Uri(request.get_Endpoint().OriginalString).Region != RegionEndpoint.USEast1) { request.set_UseSigV4(true); } }
internal static void EvaluateIfSigV4Required(IRequest request) { // Skip this for S3-compatible storage provider endpoints if ((request.OriginalRequest is S3.Model.GetObjectRequest) && (AmazonS3Uri.IsAmazonS3Endpoint(request.Endpoint))) { var region = new AmazonS3Uri(request.Endpoint.OriginalString).Region; if (region != RegionEndpoint.USEast1) { request.UseSigV4 = true; } } }
public void S3EndpointAbsoluterLegacyS3UriTest() { bool isS3Uri = AmazonS3Uri.IsAmazonS3Endpoint("https://s3.amazonaws.com/"); Assert.IsTrue(isS3Uri); }
public void S3EndpointAbsoluterRegionalS3UriTest() { bool isS3Uri = AmazonS3Uri.IsAmazonS3Endpoint("http://mybucket.s3.us-west-2.amazonaws.com/"); Assert.IsTrue(isS3Uri); }
public void S3EndpointAbsoluteNonS3UriTest() { bool isS3Uri = AmazonS3Uri.IsAmazonS3Endpoint("http://somehost.com/"); Assert.IsFalse(isS3Uri); }
public void S3EndpointRelativeUriTest() { bool isS3Uri = AmazonS3Uri.IsAmazonS3Endpoint(new Uri("server/", UriKind.Relative)); Assert.IsFalse(isS3Uri); }