This is a Java based library for interacting with the SUSE Studio image store and appliances toolkit. The library is supposed to enable developers to easily implement client applications for SUSE Studio in Java, even for mobile platforms like Android. All functionality that is offered by the Studio REST API should be covered eventually, but the implementation is at the moment still a work in progress. Feel free to send pull requests!
// Initialize SUSEStudio studio = new SUSEStudio("username", "password"); System.out.println("Version: " + studio.getApiVersion()); // Get user details User user = studio.getUser(); System.out.println("Name: " + user.getUsername()); // Disk quota DiskQuota dq = user.getDiskQuota(); System.out.println("DiskQuota: " + dq.getUsed() + " of " + dq.getAvailable());
// Get the appliances List<Appliance> appliances = studio.getAppliances(); for (Appliance a : appliances) { System.out.println("Name: " + a.getName()); System.out.println("UUID: " + a.getUuid()); System.out.println("Basesystem: " + a.getBasesystem()); System.out.println("Type: " + a.getType()); System.out.println("Edit URL: " + a.getEditUrl()); System.out.println("Raw Size: " + a.getEstimatedRawSize()); // List the builds for(Build b : a.getBuilds()) { System.out.println("Build ID: " + b.getId()); System.out.println("Download URL: " + b.getDownloadUrl()); } }
// Schedule a build ScheduleBuildResult result = studio.scheduleBuild(654321, SUSEStudio.ImageType.iso); System.out.println("Build ID: " + result.getId());
// Start a testdrive for a given build Testdrive testdrive = studio.startTestdrive(1234567); // Get information about how to access it VNCServer vncServer = testdrive.getVNCServer(); System.out.println("VNC Server Hostname: " + vncServer.getHost()); System.out.println("VNC Server Port: " + vncServer.getPort()); // Get all currently running testdrives List<Testdrive> testdrives = studio.getTestdrives(); for (Testdrive testdrive : testdrives) { System.out.println("Testdrive ID: " + testdrive.getId()); System.out.println("Build ID: " + testdrive.getBuildId()); System.out.println("State: " + testdrive.getState()); }
// Get popular appliances Gallery gallery = studio.getGallery(SUSEStudio.GALLERY_POPULAR); GalleryAppliances appliances = gallery.getAppliances(); System.out.println(appliances.getCount());
Call ant
on the commandline to build the library jarfile from sources. The artifact can be found in the dist
folder.
See the LICENSE file.