ConoHaNet.OpenStackMember.ListEndpoints C# (CSharp) Method

ListEndpoints() public method

Gets the list of endpoint
public ListEndpoints ( ) : IEnumerable
return IEnumerable
        public IEnumerable<RegionEndpoint> ListEndpoints()
        {
            if (this.UA == null)
                this.UA = IdentityProvider.GetUserAccess(Identity);
                // this.UA = IdentityProvider.GetInternalUserAccess(Identity);

            // region dictionary
            IDictionary<string, IDictionary<string, string>> regionEndpoints = new Dictionary<string, IDictionary<string, string>>();
            foreach (var catalog in this.UA.ServiceCatalog)
                foreach (var endpoint in catalog.Endpoints)
                    yield return new RegionEndpoint(catalog.Name, endpoint.Region, catalog.Type, endpoint.PublicURL);
        }

Usage Example

 public void ListEndpointsTest()
 {
     var os = new OpenStackMember(UserName, Password, TenantName, TenantId);
     var endpoints = os.ListEndpoints();
     foreach (var ep in endpoints)
     {
         Trace.WriteLine(string.Format("{0} / {1} / {2} / {3}", ep.Name, ep.Region, ep.Type, ep.Url));
     }
 }
OpenStackMember