How to get tenant id using openstack4j

asked 2016-02-13 11:33:15 -0500

Ocelot gravatar image

updated 2016-02-15 05:14:26 -0500

smaffulli gravatar image

Hi, is there a way to get the tenant id using openstack4j? I need it to create a config file. Getting swift's endpoint would be nice as well. Thanks!

Update: I finally did it with this:

        Iterator<? extends Service> i = OS.getAccess().getServiceCatalog().iterator();
        while(i.hasNext()){
            Service aux = i.next();
            if(aux.getName().compareTo("swift") == 0){
                Iterator<? extends Endpoint> j = (aux.getEndpoints()).iterator();
                while (j.hasNext()){
                    Endpoint ep = j.next();
                    System.out.println(ep.getInternalURL());
                }
            }
        }

Is there a better solution?

edit retag flag offensive close merge delete