gregkare / brightbox-cli

Brightbox Cloud CLI

Home Page:http://docs.brightbox.com/cli

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Brightbox Cloud Command Line Interface

‘brightbox-cli` is a set of cli tools to interact with the Brightbox Cloud API.

You will need a user account on the Brightbox Cloud in order to make use of these tools.

You can sign up at manage.brightbox.com

<img src=“https://travis-ci.org/brightbox/brightbox-cli.png?branch=master” alt=“Build Status” />

UPGRADE NOTES

Version 1.0.0 adds a new top level ‘brightbox` command for the suite.

This may clash with our ‘brightbox` (brightbox-deployment) gem which, before version 2.4.0, used `brightbox` as the name for it’s binary. Please ensure you update your ‘brightbox` gem to avoid using the wrong command.

We have included backwards compatible binaries for all the older CLI commands (brightbox-accounts, brightbox-servers etc…) but recommend getting used to the new form.

Installation instructions

Install from Rubygems

$ gem install brightbox-cli

Usage

The Brightbox CLI is a suite of tools that are accessible through the ‘brightbox` command in a similar way to how you access `git` commands.

For a list of available commands use:

$ brightbox help

To add client (account based) credentials use:

$ brightbox config client_add cli-2igtb theclientsecret
Using config file /home/ubuntu/.brightbox/config
Creating new api client config cli-2igtb

To browse available resources use the resource name as the command:

$ brightbox servers
... List of servers
$ brightbox images
... List of images

Command structure may be subject to change.

Using GPG to secure passwords

If you use an OAuth application to access your accounts (www.brightbox.com/docs/guides/manager/oauth-applications/) then you frequently need to renter your password.

From v1.5.0 you can store your password locally encrypted by GPG (www.gnupg.org/) which will decrypt the password when needed. This will prompt for your GPG key if not available to the GPG agent using your OS’s configured pinentry program.

You need to have setup GPG with your own keys and have configured the pinentry to prompt you when the key is locked.

The password file is named after your configuration’s alias:

$ brightbox config
 alias                 client_id  secret           api_url                         auth_url
------------------------------------------------------------------------------------------------------------------
 *main                 app-12345  xxxxxxxxxxxxxxx  https://api.gb1.brightbox.com   https://api.gb1.brightbox.com
------------------------------------------------------------------------------------------------------------------

The alias here is ‘main`. To prepare the password run this command:

$ gpg --encrypt --recipient gpg@example.com > ~/.brightbox/main.password.gpg
(type your password)<RETURN>
<CTRL+D>
# Test it with...
$ gpg --decrypt ~/.brightbox/main.password.gpg
password!2015
$ brightbox accounts
INFO: client_id: app-12345 (main)
INFO: Decrypting /home/user/.brightbox/main.password.gpg to obtain password
gpg: encrypted with 2048-bit RSA key, ID ABCDE890, created 2015-01-01
      "Jason Null <gpg@example.com>"
Your API credentials have been updated, please re-run your command.

Now when making commands you should only have to unlock your keyring to avoid typing your password.

If you are prompted to enter your password still then the file may be named incorrectly or there may be an issue with your GPG configuration.

To remove the password delete the ‘~/.brightbox/main.password.gpg` file.

Usage guides

BASH Auto-completion

A bash shell auto-completion script is provided to allow autocompletion of all sub-commands, options and resource identifiers. It is automatically configured by the Debian/Ubuntu packages, but if you’re installing from a gem you can manually tell bash about it like this:

complete -C _brightbox-bash-completer -o filenames brightbox

The command ‘_brightbox-bash-completer` should be installed in the system path when you install the gem. If for whatever reason it is not in the path, just specify the full path to it:

complete -C /full/path/to/bin/_brightbox-bash-completer -o filenames brightbox

Testing

You should be able to run the specs and features with the following steps:

$ bundle install
$ bundle exec rake

The specs use VCR to playback filtered recordings from real API sessions. This process is not perfect, please report an issue

Alternatives

There are a number of alternative ways to interact with the Brightbox Cloud.

Packaging

Vendoring libraries

gems can be vendored into ‘lib/brightbox-cli/vendor/` for packaging and will be prioritised over any gems.

Debian/Ubuntu packaging

Packaging scripts are available in github.com/NeilW/brightbox-cli-debian-packaging

License

Copyright © 2010-2013 John Leach, Brightbox Systems Ltd <john@brightbox.co.uk>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Brightbox Cloud CLI

http://docs.brightbox.com/cli

License:MIT License


Languages

Language:Ruby 100.0%