Amazon.S3.Util.BucketRegionDetector.GetBucketRegionNoPipeline C# (CSharp) Method

GetBucketRegionNoPipeline() private static method

Use a HEAD bucket request to get the region for the given bucket. This method creates an AmazonS3Client from the credentials passed in. It's critical that the AmazonS3Client is not used to make any requests that will be routed through the pipeline.
private static GetBucketRegionNoPipeline ( string bucketName, ImmutableCredentials credentials ) : string
bucketName string
credentials Amazon.Runtime.ImmutableCredentials
return string
        private static string GetBucketRegionNoPipeline(string bucketName, ImmutableCredentials credentials)
        {
            var headBucketPreSignedUrl = GetHeadBucketPreSignedUrl(bucketName, credentials);
            using (var s3Client = GetUsEast1ClientFromCredentials(credentials))
            {
                var response = AmazonS3HttpUtil.GetHead(s3Client, s3Client.Config, headBucketPreSignedUrl, HeaderKeys.XAmzBucketRegion);
                return response.HeaderValue;
            }
        }