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

GetBucketRegionNoPipelineAsync() 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 GetBucketRegionNoPipelineAsync ( string bucketName, ImmutableCredentials credentials ) : Task
bucketName string
credentials Amazon.Runtime.ImmutableCredentials
return Task
        private static async Task<string> GetBucketRegionNoPipelineAsync(string bucketName, ImmutableCredentials credentials)
        {
            var headBucketPreSignedUrl = GetHeadBucketPreSignedUrl(bucketName, credentials);
            using (var s3Client = GetUsEast1ClientFromCredentials(credentials))
            {
                return (await AmazonS3HttpUtil.GetHeadAsync(s3Client, s3Client.Config, headBucketPreSignedUrl,
                    HeaderKeys.XAmzBucketRegion).ConfigureAwait(false)).HeaderValue;
            }
        }
    }