# README
OnApp API for Golang and CLI
This is to be a library for accessing the OnApp API with a Go interface.
In addition, there is to be a command line client that will mimic the feature set of the OnApp dashboard. Install via go install github.com/alexzorin/onapp/onapp
API
Documentation for the API can be found at godoc.org
CLI
You can install the onapp
CLI command into your $GOPATH/bin
via:
go get github.com/alexzorin/onapp
+ go install github.com/alexzorin/onapp/onapp
or download a binary release from here, if available.
Get started with onapp config
, find usage via onapp help
and onapp help [command]
.
Commands
config
- Configure the tool to connect to a particular OnApp Dashboard Server (saves by default in~/.onapp
)test
: Test the confighelp
: Help text for all commands and subcommandsvm
: Management of virtual machineslist <query>
: List virtual machines and their current status in a tablestart <id>
: Start a virtual machinestop <id>
: Stop a virtual machinereboot <id>
: Reboot a virtual machinessh <id>
: Launchesssh
at the VM's first IP address and provides you with the root passwordvnc <id>
: Etablishes a VNC session on the cloud server and launchesvncviewer
(needs to be in path, at this time only RealVNC Viewer is supported)copy-id <id>
: Copies the user's~/.ssh/id_rsa.pub
to the server'sauthorized_keys
stat <id>
: SSH's into the machine (no password prompt) and runsvmstat 1 10
, which it relays tostdout
tx <id> [num_to_list]
: List of recent transactions on that VMpass <id>
: Copy password to the clipboard
Where <query>
is mentioned, you can search via any exported field in onapp.VirtualMachine
, i.e onapp vm list User=1 Booted=false
. Try onapp help vm list
for a list of fields.
Where <id>
is mentioned, you may either provide exact #ID, exact Label or Hostname, or the CLI will attempt to guess which VM you mean via text similarity. Inexact matches will prompt confirmation.
Cache
Since the OnApp API can at times be slow (when listing all virtual machines, for example), the CLI will cache a copy of the list to ~/.onapp_cache
. This copy is stripped of all root and VNC passwords.
If an item is found in the cache initially, the CLI will look the VM up at the API again (by ID, which is much faster) and retreive the passwords again.
You can also clear it using onapp vm clear-cache
.