Created
September 5, 2014 01:18
-
-
Save plombardi89/c921cc8f6c69e21ec394 to your computer and use it in GitHub Desktop.
VirtualBox SDK (via SOAP) Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@GrabResolver(name='clojars.org', root='http://clojars.org/repo') | |
@Grab('org.clojars.tbatchelli:vboxjws:4.3.4') | |
import org.virtualbox_4_3.* | |
// Setup Instructions | |
// ------------------ | |
// | |
// Getting setup is a bit of a PITA. I recommend disabling auth for testing purposes. Also in a | |
// a real development environment I would recommend pulling the vboxjws.jar from VirtualBox | |
// rather than using the version published on Clojars... why VirtualBox does not publish more | |
// recent versions of vboxjws.jar to Maven is a mystery to me. | |
// | |
// 1. disable virtualbox authentication with the following command: | |
// | |
// $ VBoxManage setproperty websrvauthlibrary null | |
// | |
// 2. start the SOAP server | |
// | |
// $ vboxwebsrv | |
// | |
// 3. Go! | |
// | |
def url="http://localhost:18083" | |
def username = null | |
def password = null | |
def vboxManager = VirtualBoxManager.createInstance(null) | |
vboxManager.connect(url, username, password) | |
def vbox = vboxManager.vbox | |
println "VirtualBox version: ${vbox.version}" | |
println "--- [Machines] ---" | |
vbox.machines.each { | |
println it.name | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment