Minimal RPC client for communication with xapi - more a PoC than anything else
  • Rust 78.7%
  • Shell 17.4%
  • PowerShell 3.9%
Find a file
Marcello Seri 3a626e9eab README: link to xapi
Signed-off-by: Marcello Seri <marcello.seri@citrix.com>
2018-03-01 17:20:30 +00:00
ci travis, appveyor: fix target names 2018-02-20 17:53:34 +00:00
src lib: port to xmlrpc 0.11.0 2018-02-28 21:08:12 +00:00
.gitignore Initial Commit 2017-10-31 12:32:25 +00:00
.travis.yml travis: disable running cli, it would fail 2018-02-20 17:17:41 +00:00
appveyor.yml travis: disable running cli, it would fail 2018-02-20 17:17:41 +00:00
Cargo.lock lib: port to xmlrpc 0.11.0 2018-02-28 21:08:12 +00:00
Cargo.toml lib: port to xmlrpc 0.11.0 2018-02-28 21:08:12 +00:00
LICENSE.md Add metadata and license 2018-02-15 21:29:45 +00:00
README.md README: link to xapi 2018-03-01 17:20:30 +00:00
TODO.md README, TODO: update 2018-02-25 18:44:38 +00:00

xapirpc Build Status Doc Badge Latest Version

Minimal library and CLI client for xapi rpc calls.


The crate provides a small CLI utility to make RPC calls to xapi, and exports a library that exposes some common helpers to create xapi clients (see the documentation on docs.rs). The CLI executable provides an example of use.

The output of the CLI tool is in json, so it can be piped to jq or other json tools for further filtering. For example you can get the uuid and name_label of all VMs with:

xapirpc VM get_all_records | jq '.[]|select(.is_a_template==false)|{uuid, name_label}'

There CLI help should clarify all the supported customisations.

$ xapirpc --help
Minimal xapi xmlrpc CLI client
USAGE:
    xapirpc [FLAGS] [OPTIONS] <class> <method> [args]...
FLAGS:
        --compact    Output the result as non-prettified json
        --help       Prints help information
    -V, --version    Prints version information
OPTIONS:
    -h, --host <host>    XenServer host. Can be passed with the XAPI_HOST env variable.
    -p, --pass <pass>    XenServer host user password. Can be passed with the XAPI_PASSWORD env variable.
    -u, --user <user>    XenServer host user name. Can be passed with the XAPI_USER env variable.
ARGS:
    <class>      Case sensitive value for the xapi class
    <method>     Case sensitive value for the xapi method
    <args>...    Ordered list of arguments for the call (if any). Do not pass a session.

The host, user, and pass value can be manually configured by creating

$HOME/.config/xapirpc/config.prefs.json

and adding them in a json object. E.g.

$ cat $HOME/.config/xapirpc/config.prefs.json
{"user":"my_user_name","pass":"my_pass"}

To try it, clone this repository and build with cargo build --release or install it using cargo install xapirpc --force.

Acknowledgements

Thanks:

  • @gaborigloi for porting the library to quicli
  • @Pistahh for fixing the jq example and comments on the code