commit | ab422a52c88edcdb214717a5552bda1498f9fb6c | [log] [tgz] |
---|---|---|
author | Ioannis Canellos <iocanel@apache.org> | Mon Dec 10 19:53:54 2012 +0200 |
committer | Ioannis Canellos <iocanel@apache.org> | Mon Dec 10 19:53:54 2012 +0200 |
tree | f7deff32ea90b7c9358a7f8aecfbe0eb6312e351 | |
parent | 9b1bb50ae74e7b6cde35d24407be0d971aec0473 [diff] |
Also load jars found in the deploy folder.
Jclouds CLI provides two types of command line interface:
To install the jclouds cli you just need to download the zip or the tarball and extract it to the folder of your choice.
You can use the jclouds cli to perform misc operations, such as creating a node, run scripts on a node, list nodes, destroy a node etc. The cli also supports blobstore, so you can create, delete or access a blobstore.
To use the cli: ./bin/jclouds [category] [action] [options] [arguments].
Some examples: To create 10 nodes on EC2 under group: myGroupName using Ubuntu 10.04
To list all nodes:
To destroy a node:
APIs work in the same manner as providers, but you will also need to specify the endpoint.
To start the interactive shell: ./bin/jclouds-cli
The are two ways of configuring a provider or api, when using the interactive mode:
All commands support the following options that you can use: --provider (use this for apis too), --identity, --credential --endpoint.
For example, in a fresh installation you can simple:
jclouds:node-list --provider [my provider or api] --identity [my identity] --credential [my credential] --endpoint [my endpoint]
If you want to avoid passing the same options all the time, you can configure the provider or the api once and reuse it. To configure the provider or the api:
For compute providers & apis:
jclouds:compute-service-create --provider [provider] --identity [identity] --credential [credential] jclouds:compute-service-create --api [api] --identity [identity] --credential [credential] --endpoint [endpoint]
For blobstore providers or apis:
jclouds:blobstore-service-create --provider [provider] --identity [identity] --credential [credential] jclouds:blobstore-service-create --api [api] --identity [identity] --credential [credential] --endpoint [endpoint]
To list the available compute or blobstore services:
jclouds:compute-service-list (for compute providers and apis) jclouds:blobstore-service-list (for blobstore providers and apis)
You can also remove one of the services:
jclouds:compute-service-destroy --provider [provider] jclouds:blobstore-service-destroy --provider [provider]
Installing additional providers and api The interactive version of the cli will have out of the box installed support for the mainstream providers and apis. To enable the any other provider or api, you will need to enable it. This is done using the features commands.
List the available jclouds modules:
features:list
To install an additional api (say cloudstack)
features:install jclouds-api-cloudstack
Both in the interactive shell and cli modes, you may find repeating the provider information again and again not really friendly. You can completely skip those options by sepcifying them as environmental variables.
Supported variables:
JCLOUDS_COMPUTE_PROVIDER
JCLOUDS_COMPUTE_API
JCLOUDS_COMPUTE_ENDPOINT
JCLOUDS_COMPUTE_IDENTITY
JCLOUDS_COMPUTE_CREDENTIAL
JCLOUDS_BLOBSTORE_PROVIDER
JCLOUDS_BLOBSTORE_API
JCLOUDS_BLOBSTORE_ENDPOINT
JCLOUDS_BLOBSTORE_IDENTITY
JCLOUDS_BLOBSTORE_CREDENTIAL
As of jclouds-cli version 1.5.0 commands support output customization. The customization features are:
The configuration for all columns can be found inside the org.jclouds.shell pid. Each configuration key is prefixed using the command category (node, image, location, hardware etc). The suffix defines the configuration topic. For example hardware.headers defines the headers to be displayed by the hardware commands. In the following commands the hardware category will be used as example.
Defining the command headers To specify the headers of a command we need to place to specify the headers configuration as a semicoln separated list. For hardware:
hardware.headers=[id];[ram];[cpu];[cores]
Defining the display data Display data are configured as a comma separated list of expressions (using the scripting engine of your choice, default is groovy). The expressions will be evaluated on the object of interest (in our example the hardware object). To display the id field of the hardware object the expression to use is hardware.id. The reason for choosing groovy (as a default) for retrieving the data and not a simple expression language is that groovy is powerfull and can be used for more complex expressions. For example the Hardware object contains a collection of Processors and each processor has a filed of cores. To display the sum of cores among processors, we can use the following expression: hardware.processors.sum{it.cores}.
You can change the scripting engine:
hardware.engine=groovy
Please note that if you don't specify the engine, then groovy will be assumed.
To specify the display data, now all you need to do is to provide the expressions:
hardware.expressions=hardware.id;hardware.ram;hardware.processors.sum{it.cores*it.speed};hardware.processors.sum{it.cores}
The configuration above will display the hardware id in the first column, the hardware ram in the second column, the sum of cores X speed per processor in the third column and finally the sum of cores for all processors in the last column.
Defining the sort order To specify the sort column, the sortBy option can be used to point to the header of the column of interest. For example hardware hardware.shortby=[cpu].
Changing the delimeter Most of the configuration options for the shell table are passed as delimited strings. What happens when you want to change the delimiter? By default the delimeter is the semicoln symbol, but for each command category you can specify the delimiter. For example:
hardware.delimeter=, hardware.headers=[id],[ram],[cpu],[cores]
https://github.com/jclouds/jclouds/ https://github.com/jclouds/jclouds-karaf/