Rust-Docli rs v0.1.0-beta2: docli — A command line utility for managing DigitalOcean infrastructure

icon
Latest Release: v0.1.0-beta2

v0.1.0-beta2 (2015-06-07)

Documentation

Bug Fixes

  • --nosend and --verbose propogate fully now (ede3df4c, closes #12)
Source code(tar.gz)
Source code(zip)

docli-rs (pronounced "dockly")

Build Status GitHub release GitHub license Join the chat at https://gitter.im/kbknapp/docli-rs

A command-line utility for managing DigitalOcean infrastructure via the DigitalOcean API v2

Disclaimer

This utility is in beta - it may do anything up to, and including, eating your laundry. You can check the request being sent to DigitalOcean without actually sending by using the docli --nosend --verbose <command> (which can be shortened to docli -nv <command>)

Installation

Linux / OSX

If you are on Arch linux, you can install from the AUR via the docli-bin or docli-git (-git requires a nightly Rust compiler and git).

Linux or OS X (x86_64) Binaries

Download the tar.gz, untar, and copy to somewhere in your $PATH (if on OS X, replace linux with osx)

$ wget http://wod.twentyfives.net/bin/docli/docli-0.1.0-beta2-x86_64-linux.tar.gz
$ tar xvf docli-0.1.0-beta2-x86_64-linux.tar.gz
$ cp docli-0.1.0-beta2-x86_64-linux/bin/docli ~/.bin

In the example ~/.bin is in $PATH

Windows (None yet...)

I have not tried compiling on Windows [yet]. Feel free to clone the repository and attempt to compile with a nightly Rust compiler.

Compile from source

If you'd rather compile from source (takes about 2 minutes on a decent machine) use the following:

Note: Currently, you must use Rust nightly in order to compile.

$ git clone https://github.com/kbknapp/docli-rs
$ cd docli-rs
$ cargo build --release
$ cp target/release/docli ~/.bin

Usage

You can run docli from the command line and along with various subcommands to perform actions on your DigitalOcean infrastructure. In order to see what commands are available, run docli --help or docli <command> --help

docli v0.1.0
Kevin K. <[email protected]>
A utility for managing DigitalOcean infrastructure

USAGE:
    docli [FLAGS] [OPTIONS] [SUBCOMMANDS]

FLAGS:
    -h, --help       Prints help information
    -n, --nosend     Does NOT send request over the network (useful with --verbose)
        --version    Prints version information
    -v, --verbose    Displays the request being sent to server and JSON reply

OPTIONS:
    -t, --token <token>        Digital Ocean Auth Token (Defaults to contents of DO_AUTH_TOKEN env var if omitted)

SUBCOMMANDS:
    account     Show account information and actions
    dns         Manage DNS records on a specific domain
    domains     Manage domains
    droplet     Manage a specific droplet
    droplets    Manage droplets
    help        Prints this message
    image       Manage images
    list        Get information from DigitalOcean about various sections
    ssh-keys    Manage SSH keys

DigitalOcean Personal OAuth Token

In order to use the DigitalOcean v2 API (which is what docli uses under the covers, you must generate a Personal Authentication Token. This token can then either be passed to docli directly with --token <token> or you can set a DO_AUTH_TOKEN environmental variable before using docli. To do so using Linux or OSX, open a terminal and run the following (test with docli account which lists your account information):

$ export DO_AUTH_TOKEN=<PASTE YOUR TOKEN HERE>
$ docli account

Personal Auth Token's can be Read/Write, or Read Only/Write Only. In order to process destructive API calls (i.e. ones that modify existing information) you must have a token with Write priviledges.

To generate a new Personal Auth Token see the following DigitalOcean details

Contributing

Contributions are always welcome! And there is a multitude of ways in which you can help depending on what you like to do, or are good at. Anything from documentation, code cleanup, issue completion, new features, you name it, even filing issues is contributing and greatly appreciated!

NOTE: One of the best ways to help right now is to simply use the utility and report issues!

  1. Fork docli
  2. Clone your fork (git clone https://github.com/$YOUR_USERNAME/docli-rs && cd docli-rs)
  3. Create new branch (git checkout -b new-branch)
  4. Make your changes, and commit (git commit -am "your message")
  • I use a conventional changelog format so I can update my changelog using clog
  • Format your commit subject line using the following format: TYPE(COMPONENT): MESSAGE where TYPE is one of the following:
    • feat - A new feature
    • imp - An improvement to an existing feature
    • perf - A performance improvement
    • docs - Changes to documentation only
    • tests - Changes to the testing framework or tests only
    • fix - A bug fix
    • refactor - Code functionality doesn't change, but underlying structure may
    • style - Stylistic changes only, no functionality changes
    • wip - A work in progress commit (Should typically be git rebase'ed away)
    • chore - Catch all or things that have to do with the build system, etc
  • The COMPONENT is optional, and may be a single file, directory, or logical component. Can be omitted if commit applies globally
  1. git rebase into concise commits and remove --fixups (git rebase -i HEAD~NUM where NUM is number of commits back)
  2. Push your changes back to your fork (git push origin $your-branch)
  3. Create a pull request! (You can also create the pull request first, and we'll merge when ready. This a good way to discuss proposed changes.)

Comments

  • The new
    The new "Floating IPs" are not handled

    Jan 22, 2016

    ❯ ./target/debug/docli account
    :: Displaying account information...Failed
    
        unknown field "floating_ip_limit" at line 0 column 0
    

    (I do have $DO_AUTH_TOKEN set.)

    This makes it impossible to retrieve account information, though droplet / SSH key information retrieval seems to work.

    bug 
    Reply
  • chore: update dependencies
    chore: update dependencies

    Mar 10, 2016

                                                                                                                                                                                                           
    Reply
  • Add colored output
    Add colored output

    May 20, 2015

    Via opt-out cargo feature

    cli 
    Reply
  • Confirm dns command
    Confirm dns command

    Jun 4, 2015

    • [x] docli dns <domain> records
    • [x] docli dns <domain> create-record <type> [rec_name] [data] [priority] [port] [weight]
    • [x] docli dns <domain> record <id>
    • [x] docli dns <domain> update-record <id> <type> [rec_name] [data] [priority] [port] [weight]
    • [x] docli dns <domain> delete-record <id>
    cli 
    Reply
  • --verbose and --nosend not propagating all the way
    --verbose and --nosend not propagating all the way

    Jun 4, 2015

    See kbknapp/clap-rs#137

    bug cli 
    Reply
  • Add a Gitter chat badge to README.md
    Add a Gitter chat badge to README.md

    Aug 21, 2015

    kbknapp/docli-rs now has a Chat Room on Gitter

    @kbknapp has just created a chat room. You can visit it here: https://gitter.im/kbknapp/docli-rs.

    This pull-request adds this badge to your README.md:

    Gitter

    If my aim is a little off, please let me know.

    Happy chatting.

    PS: Click here if you would prefer not to receive automatic pull-requests from Gitter in future.

    Reply
  • Updates
    Updates

    Oct 29, 2015

                                                                                                                                                                                                           
    Reply
  • chore: dep update
    chore: dep update

    Nov 13, 2015

                                                                                                                                                                                                           
    Reply
  • chore(Cargo.lock): update dependencies
    chore(Cargo.lock): update dependencies

    Feb 21, 2016

                                                                                                                                                                                                           
    Reply
  • Confirm ssh-keys command
    Confirm ssh-keys command

    Jun 4, 2015

    • [x] docli ssh-keys create <name> <public_key>
    • [x] docli ssh-keys show-key <id>
    • [x] docli ssh-keys rename <id> <name>
    • [x] docli ssh-keys destroy <id>
    • [x] docli ssh-keys
    cli 
    Reply
  • chore: fix the build
    chore: fix the build

    Jan 22, 2016

    The build was broken on nightly.

    This update the dependencies and removes problematic lints.

    Reply
  • chore: update dependencies
    chore: update dependencies

    Feb 16, 2016

                                                                                                                                                                                                           
    Reply