Beispiel #1
0
        /// <summary>
        /// Resolve region bucket resides in.
        /// </summary>
        /// <param name="bucketName"></param>
        /// <returns></returns>
        private async Task <string> GetRegion(string bucketName)
        {
            // Use user specified region in client constructor if present
            if (this.Region != string.Empty)
            {
                return(this.Region);
            }

            // pick region from endpoint if present
            string region = Regions.GetRegionFromEndpoint(this.Endpoint);

            // Pick region from location HEAD request
            if (region == string.Empty)
            {
                if (!BucketRegionCache.Instance.Exists(bucketName))
                {
                    region = await BucketRegionCache.Instance.Update(this, bucketName).ConfigureAwait(false);
                }
                else
                {
                    region = BucketRegionCache.Instance.Region(bucketName);
                }
            }
            // Default to us-east-1 if region could not be found
            return((region == string.Empty) ? "us-east-1" : region);
        }
        private String getRegion(string url)
        {
            if (!string.IsNullOrEmpty(this.Region))
            {
                return(this.Region);
            }
            string region = Regions.GetRegionFromEndpoint(url);

            return((region == "") ? "us-east-1" : region);
        }
Beispiel #3
0
        private string GetRegion(string url)
        {
            if (!string.IsNullOrEmpty(this.region))
            {
                return this.region;
            }

            string region = Regions.GetRegionFromEndpoint(url);
            return (region == string.Empty) ? "us-east-1" : region;
        }
Beispiel #4
0
        private String getRegion(string url)
        {
            string region = Regions.GetRegionFromEndpoint(url);

            return((region == "") ? "us-east-1" : region);
        }