{"id":26032601,"url":"https://github.com/apache/karaf-jclouds-cli","last_synced_at":"2025-04-09T23:52:58.488Z","repository":{"id":65979498,"uuid":"164282147","full_name":"apache/karaf-jclouds-cli","owner":"apache","description":"Apache jClouds CLI","archived":false,"fork":false,"pushed_at":"2023-12-16T17:19:41.000Z","size":267,"stargazers_count":3,"open_issues_count":1,"forks_count":5,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-03T04:17:02.466Z","etag":null,"topics":["java","karaf","network-server","osgi"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apache.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-01-06T06:37:31.000Z","updated_at":"2023-09-23T07:26:39.000Z","dependencies_parsed_at":"2024-01-29T03:57:45.933Z","dependency_job_id":null,"html_url":"https://github.com/apache/karaf-jclouds-cli","commit_stats":null,"previous_names":[],"tags_count":67,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fkaraf-jclouds-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fkaraf-jclouds-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fkaraf-jclouds-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fkaraf-jclouds-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apache","download_url":"https://codeload.github.com/apache/karaf-jclouds-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247899473,"owners_count":21014904,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","karaf","network-server","osgi"],"created_at":"2025-03-06T22:13:52.098Z","updated_at":"2025-04-09T23:52:58.458Z","avatar_url":"https://github.com/apache.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"jclouds-cli\n===========\njclouds-cli is tool that allows you to interact with [jclouds](https://github.com/jclouds/jclouds) Compute, Blobstore and Chef services.\nIt is easy to use, configurable, extensible and it comes into 2 flavors:\n\n* **An interactive shell**.\n    * *Rich completion for commands, options and arguments*\n    * *Reusability of services*\n    * *Modularity and Extensibility*\n* **A shell script**.\n    * *Easily used from other scripts*.\n\nBoth flavors support reading configuration from environmental variables, so that you don't have to repeat the same options again and again.\n\nInstallation\n------------\nTo install the jclouds cli you just need to download the [zip or the tarball](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.apache.jclouds.cli%22%20AND%20a%3A%22jclouds-cli-assembly%22) and extract it to the folder of your choice.\n\nUsing the CLI\n-------------\nYou 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.\nThe cli also supports blobstore, so you can create, delete or access a blobstore.\n\nNote that all cli invocations require parameters to be specified in the following order:\n\n    **[category]** **[action]** **[options]** **[arguments]**\n\n**Compute Service Usage**:\n\n    ./bin/jclouds **[category]** **[action]** **[options]** **[arguments]**.\n\n* *Categories*: node, group, image, location, hardware.\n* *Actions*: list, create, destroy, runscript.\n* *Options*: --provider --api, --identity, --credential, --endpoint etc.\n\n\n**Compute Service Examples**:\nTo create 10 nodes on EC2 under group: myGroupName using Ubuntu 10.04\n\n    ./jclouds node create --provider aws-ec2 --identity [identity] --credential [credential] --os-family ubuntu --os-version 10.04 --adminAccess myGroupName 10\n\n\nTo list all nodes:\n\n    ./jclouds node list --provider aws-ec2 --identity [identity] --credential [credential]\n\n\nTo destroy a node:\n\n    ./jclouds node destroy [node id]\n\n\n**Blobstore Usage**:\n\n    ./bin/jclouds **[category]** **[action]** **[options]** **[arguments]**.\n\n* *Categories*: blobstore,\n* *Actions*: list, create, destroy, read, write\n* *Options*: --provider --api, --identity, --credential, --endpoint etc.\n\n\n**Blobstore Examples**:\nTo create a container on S3:\n\n    ./jclouds blobstore create --provider aws-s3 --identity [identity] --credential [credential] mycontainer\n\nTo list the content of container:\n\n    ./jclouds blobstore list --provider aws-s3 --identity [identity] --credential [credential] mycontainer\n\n\nTo copy a file to a blob:\n\n    ./jclouds blobstore write --provider aws-s3 --identity [identity] --credential [credential] mycontainer myblob /path/to/file\n\nTo copy using a url to a blob:\n\n    ./jclouds blobstore write --provider aws-s3 --identity [identity] --credential [credential] --url-payload mycontainer myblob myurl\n\nTo write a string value to a blob:\n\n    ./jclouds blobstore write --provider aws-s3 --identity [identity] --credential [credential] --string-payload mycontainer myblob myvalue\n\n\nAPIs work in the same manner as providers, but you will also need to specify the endpoint.\n**Chef Usage:**:\n\n    ./bin/chef **[category]** **[action]** **[options]** **[arguments]**.\n\n* *Categories*: cookbook, node group.\n* *Actions*: list, bootstrap.\n* *Options*: --api, --client-name, --client-key-file, --validator-name, --validator-key-file, --endpoint etc.\n\n**Chef Examples:**:\n\nTo list all cookbooks:\n\n    ./bin/chef cookbook list --client-name [client name] --client-key-file [path to client key file] --endpoint [endpoint]\n\nTo bootstrap an existing compute node:\n\n    ./bin/chef node bootstrap --provider aws-ec2 --identity [identity] --credential [credential] --client-name [client name] --client-key-file [path to client key file] --endpoint [endpoint] [node id] [recipe]\n\nTo bootstrap an existing compute group:\n\n    ./bin/chef group bootstrap --provider aws-ec2 --identity [identity] --credential [credential] --client-name [client name] --client-key-file [path to client key file] --endpoint [endpoint] [group id] [recipe]\n\nTo create a new compute node and apply a recipe:\n\n    ./jclouds node create --provider aws-ec2 --identity [identity] --credential [credential] --recipe chef/myrecipe [node group]\n\n\nUsing the interactive shell\n---------------------------\nTo start the interactive shell:\n./bin/jclouds-cli\n\nThe interactive shell is a lightweight container powered by [Apache Karaf](http://karaf.apache.org) which is modular and extensible.\nOut of the box it has installed support of all compute, blobstore providers and Chef. You can easily add or remove providers, apis, drivers etc using the features commands:\n\n    feature:list\n\nWill list all the available features, that you can install. Some examples of adding additional feature:\n\n    feature:install jclouds-cloudsigma2-mia\n\nAll commands that are available from the script are also available in the interactive mode. The only difference is that in the interactive mode the **category** and **action** are encoded in the command name.\nSo all jclouds and chef commands follow the following format:\n\n    scope:category-action [options] [arguments]\n\nFor example:\n\n    jclouds:node-list --provider aws-ec2 --identity [identity] --credential [credential]\n    jclouds:blobstore-list --provider aws-s3 --identity [identity] --credential [credential]\n    chef:cookbook-list --client-name [client name] --client-key-file [path to client key file] --endpoint [endpoint]\n\n\nOne of the advantages of using the interactive shell is that it provides the ability to reuse services, and avoid the options boilerplate.\n\n**Creating a reusable Compute Service**\n\n    jclouds:compute-service-create --provider [provider] --identity [identity] --credential [credential] --name [service name]\n    jclouds:compute-service-create --api [api] --identity [identity] --credential [credential] --endpoint [endpoint] --name [service name]\n\nIf no name option specified the provider or api will be used instead.\nTo list the available compute services:\n\n    jclouds:compute-service-list\n\nHere's an example output that list 2 services registered for the aws-ec2 provider. The service are named myec2 and yaec2:\n\n    Compute APIs:\n    -------------\n    [id]                     [type]       [service]\n    ec2                      compute      [ ]\n    stub                     compute      [ ]\n\n\n    Compute Providers:\n    ------------------\n    [id]                     [type]       [service]\n    aws-ec2                  compute      [ myec2 yaec2 ]\n\n\nThen you can reuse the service from the other commands with the following way:\n\n    jclouds:node-list --name [service name]\n    jclouds:node-create --name [service name]\n\nNote that if there is only a single compute service available then the --name is optional. The same applies if there is a single service per api or provider. You can just specify the provider or the api and the shell will pick up the right service for you.\nRecreating a service with the same name, will replace the the service. Finally you can destroy a service using the following command:\n\n    jclouds:compute-service-destroy [serice name]\n\n**Reusing Compute Services Examples**:\nTo create 10 nodes on EC2 under group: myGroupName using Ubuntu 10.04 and reusing myec2 service:\n\n    jclouds:node-create --name myec2 --os-version 10.04 --adminAccess myGroupName 10\n\n\nTo list all nodes:\n\n    jclouds:node-list --name myec2\n\n\nTo destroy a node:\n\n    jclouds:node-destroy --name myec2\n\n\n**Creating a reusable BlobStore Service**\n\n    jclouds:blobstore-service-create --provider [provider] --identity [identity] --credential [credential] --name [service name]\n    jclouds:blobstore-service-create --api [api] --identity [identity] --credential [credential] --endpoint [endpoint] --name [service name]\n\nIf no name option specified the provider or api will be used instead.\nTo list the available blobstore services:\n\n    jclouds:blobstore-service-list\n\nHere's an example output that list 2 services registered for the aws-s3 provider. The service are named mys3 and yas3:\n\n    BlobStore APIs:\n    -------------\n    [id]                     [type]       [service]\n    s3                       blobstore    [ ]\n    transient                blobstore    [ ]\n\n\n    BlobStore Providers:\n    ------------------\n    [id]                     [type]       [service]\n    aws-ec2                  blobstore    [mys3 yas3]\n\n\nThen you can reuse the service from the other commands with the following way:\n\n    jclouds:blobstore-list --name [service name]\n    jclouds:blobstore-write --name [service name]\n\nNote that if there is only a single blobstore service available then the --name is optional. The same applies if there is a single service per api or provider. You can just specify the provider or the api and the shell will pick up the right service for you.\nRecreating a service with the same name, will replace the the service. Finally you can destroy a service using the following command:\n\n    jclouds:blobstore-service-destroy [serice name]\n\n**Reusing BlobStore Services Examples**:\nTo create a container on S3 using service mys3:\n\n    jclouds:blobstore-create --name mys3 mycontainer\n\nTo list the content of container:\n\n    jclouds:blobstore-list --name mys3 mycontainer\n\n\nTo copy a file to a blob:\n\n    jclouds:blobstore-write --name mys3 mycontainer myblob /path/to/file\n\nTo copy using a url to a blob:\n\n    jclouds:blobstore-write --name mys3 --url-payload mycontainer myblob myurl\n\nTo write a string value to a blob:\n\n    jclouds:blobstore-write --name mys3 --string-payload mycontainer myblob myvalue\n\n**Creating a reusable Chef Service**\n\n    chef:service-create --api [api] --client-name [client name] --client-key-file [path to client key file] --endpoint [endpoint]\n\nIf no name option specified api will be used which defaults to \"chef\"..\nTo list the available chef services:\n\n    chef:chef-service-list\n\nHere's an example output that list 2 services registered for the aws-s3 provider. The service are named mys3 and yas3:\n\n    Chef APIs:\n    -------------\n    [id]                     [type]       [service]\n    chef                     chef         [mychef yachef]\n    transient                chef         [ ]\n\n\nThen you can reuse the service from the other commands with the following way:\n\n    chef:cookbook-list --name [service name]\n\nNote: In most cases, you'll only need a single service from the chef api, so it's usually pretty safe to skip --api or --name option.\n\n    chef:service-destroy [serice name]\n\n**Reusing Chef Services Examples**:\nTo list all cookbooks for the chef service named mychef:\n\n    chef:cookbook-list --name mychef\n\nTo bootstrap an existing compute node that is managed by myec2 compute service *(here we are reusing 2 services in a single command)*:\n\n    chef:node-bootstrap --name myec2 --chef-name mychef my-node-id java::openjdk\n\nThe same for an entire group:\n\n    chef:node-bootstrap --name myec2 --chef-name mychef my-group java::openjdk\n\nTo create a new compute node and apply a recipe:\n\n    jclouds:node-create --name mlycec2 --recipe mychef/myrecipe mygroup\n\n\nLeveraging environmental variables\n----------------------------------\nBoth in the interactive shell and cli modes, you may find repeating the provider information again and again not really friendly.\nYou can completely skip those options by specifying them as environmental variables.\n\nFor Compute Services:\n\n* **JCLOUDS_COMPUTE_PROVIDER** The name of the compute provider.\n* **JCLOUDS_COMPUTE_API** The name of the compute api.\n* **JCLOUDS_COMPUTE_IDENTITY** The identity for accessing the compute provider.\n* **JCLOUDS_COMPUTE_CREDENTIAL** The credential for accessing the compute provider.\n* **JCLOUDS_COMPUTE_ENDPOINT** The endpoint (This is usually needed when using compute apis).\n* **JCLOUDS_USER** The username of that will be used for accessing compute instances.\n* **JCLOUDS_PASSWORD** The password that will be used for accessing compute instances.\n\nFor Blob Stores:\n\n* **JCLOUDS_BLOBSTORE_PROVIDER** The name of the blobstore provider.\n* **JCLOUDS_BLOBSTORE_API** The name of the blobstore api.\n* **JCLOUDS_BLOBSTORE_IDENTITY** The identity for accessing the blobstore provider.\n* **JCLOUDS_BLOBSTORE_CREDENTIAL** The credential for accessing the blobstore provider.\n* **JCLOUDS_BLOBSTORE_ENDPOINT** The endpoint (This is usually needed when using blobstore apis).\n\nFor Chef:\n\n* **JCLOUDS_CHEF_API** The name of the blobstore api.\n* **JCLOUDS_CHEF_CLIENT_NAME** The client name.\n* **JCLOUDS_CHEF_CLIENT_CREDENTIAL** The client credential.\n* **JCLOUDS_CHEF_CLIENT_KEY_FILE** The path of the client key file (can be used instead of the above).\n* **JCLOUDS_CHEF_VALIDATOR_NAME** The validator name.\n* **JCLOUDS_CHEF_VALIDATOR_CREDENTIAL** The validator credential.\n* **JCLOUDS_CHEF_VALIDATOR_KEY_FILE** The path of the validator key file (can be used instead of the above).\n* **JCLOUDS_CHEF_ENDPOINT** The endpoint (This is usually needed when using chef apis).\n\nConfiguring command output\n--------------------------\nAs of jclouds-cli version 1.5.0 commands support output customization. The customization features are:\n\n* **Width calculation** The commands calculate the required column width and adjust the format accordingly.\n* **Configurable columns** Can add remove columns using configuration.\n* **Groovy value retrieval** The display content is configurable using groovy expressions.\n* **Configurable column alignment** You can configure for each column left or right alignment.\n* **Configurable sorting options** Configure ordering by column using ascending or descending order.\n\nThe 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).\nThe suffix defines the configuration topic. For example hardware.headers defines the headers to be displayed by the hardware commands.\nIn the following commands the hardware category will be used as example.\n\n**Defining the command headers**\nTo specify the headers of a command we need to place to specify the headers configuration as a semicolon separated list.\nFor hardware:\n\n\n    hardware.headers=[id];[ram];[cpu];[cores]\n\n\n**Defining the display data**\nDisplay 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).\nTo 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 powerful and can be used for more complex expressions.\nFor 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}.\n\nYou can change the scripting engine:\n\n    hardware.engine=groovy\n\nPlease note that if you don't specify the engine, then groovy will be assumed.\n\nTo specify the display data, now all you need to do is to provide the expressions:\n\n    hardware.expressions=hardware.id;hardware.ram;hardware.processors.sum{it.cores*it.speed};hardware.processors.sum{it.cores}\n\nThe 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.\n\n**Defining the sort order**\nTo specify the sort column, the sortBy option can be used to point to the header of the column of interest.\nFor example hardware hardware.sortby=[cpu].\n\n**Changing the delimiter**\nMost of the configuration options for the shell table are passed as delimited strings. What happens when you want to change the delimiter?\nBy default the delimiter is the semicolon symbol, but for each command category you can specify the delimiter. For example:\n\n\n    hardware.delimiter=,\n    hardware.headers=[id],[ram],[cpu],[cores]\n\n\nSee also\n--------\n* https://github.com/jclouds/jclouds/\n* https://github.com/jclouds/jclouds-karaf/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Fkaraf-jclouds-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapache%2Fkaraf-jclouds-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Fkaraf-jclouds-cli/lists"}