Example #1
0
        private List <string> GetAccountRegions(BsonDocument isMasterResponse)
        {
            const string  HostsElement = "hosts";
            List <string> regions      = new List <string>();
            string        regionValue  = string.Empty;

            //post process result to retrive endpoint
            BsonValue hostsVal;

            if (isMasterResponse.TryGetValue(HostsElement, out hostsVal))
            {
                //populate result
                BsonArray hosts = hostsVal.AsBsonArray;
                foreach (var host in hosts)
                {
                    string endpoint = host.AsString;
                    int    index    = endpoint.IndexOf(':');
                    if (index != -1)
                    {
                        endpoint = endpoint.Substring(0, index);
                    }

                    regions.Add(AzureRegionsMap.GetRegionName(endpoint));
                }
            }

            return(regions);
        }
Example #2
0
            = new Dictionary <string, string>(); //region from endpoint -> official Azure region name

        static AzureRegionsMap()
        {
            AzureRegionsMap.PopulateAzureRegions();
        }