コード例 #1
0
        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));
            }
        }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
 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;
         }
     }
 }
コード例 #4
0
        public void S3EndpointAbsoluterLegacyS3UriTest()
        {
            bool isS3Uri = AmazonS3Uri.IsAmazonS3Endpoint("https://s3.amazonaws.com/");

            Assert.IsTrue(isS3Uri);
        }
コード例 #5
0
        public void S3EndpointAbsoluterRegionalS3UriTest()
        {
            bool isS3Uri = AmazonS3Uri.IsAmazonS3Endpoint("http://mybucket.s3.us-west-2.amazonaws.com/");

            Assert.IsTrue(isS3Uri);
        }
コード例 #6
0
        public void S3EndpointAbsoluteNonS3UriTest()
        {
            bool isS3Uri = AmazonS3Uri.IsAmazonS3Endpoint("http://somehost.com/");

            Assert.IsFalse(isS3Uri);
        }
コード例 #7
0
        public void S3EndpointRelativeUriTest()
        {
            bool isS3Uri = AmazonS3Uri.IsAmazonS3Endpoint(new Uri("server/", UriKind.Relative));

            Assert.IsFalse(isS3Uri);
        }