//import java.util.List;
////import org.openstack4j.api.OSClient.OSClientV3;//import org.openstack4j.openstack.OSFactory;//import org.openstack4j.model.common.Identifier;//import org.openstack4j.model.compute.Flavor;//import org.openstack4j.model.identity.v3.Project;//import org.openstack4j.model.identity.v3.User;////public class openstack { // public static void main(String[] args) { // OSClientV3 os=OSFactory.builderV3()// .endpoint("http://ahwater-cloud-controller:35357/v3")// .credentials("admin", "ahwater", Identifier.byId("default"))// .scopeToProject(Identifier.byName("admin"),Identifier.byId("default"))// .authenticate();// List<? extends User> users = os.identity().users().list();// System.out.println(users.size());// // List<? extends Project> projectList = os.identity().projects().list();// System.out.println(projectList.size());// // List<? extends Flavor> flavors = os.compute().flavors().list();// System.out.println(flavors.size());// // }//}import java.util.List;import org.openstack4j.openstack.OSFactory;import org.openstack4j.api.Builders;import org.openstack4j.api.OSClient.OSClientV2;import org.openstack4j.api.types.Facing;import org.openstack4j.model.identity.v2.*;import org.openstack4j.model.storage.block.Volume;public class openstack { public static void main(String[] args) { // TODO Auto-generated method stub OSClientV2 os=OSFactory.builderV2() .endpoint("http://ahwater-cloud-controller:35357/v2.0") .credentials("adminTest", "ahwater") .tenantName("admin") .perspective(Facing.ADMIN) .authenticate(); List<? extends User> users = os.identity().users().list(); System.out.println("users: "+users.size()); // List all Tenants List<? extends Tenant> tenants = os.identity().tenants().list(); System.out.println("tenants: "+tenants.size());// System.out.println("tenants detail:"+tenants.toString()); // List<? extends Flavor> flavors = os.compute().flavors().list();// System.out.println(flavors.size());// // List<? extends Volume> volumes = os.blockStorage().volumes().list();// System.out.println(volumes.size());// // List<? extends SwiftContainer> containers = os.objectStorage().containers().list();// System.out.println(containers.size()); }}