- Notifications
You must be signed in to change notification settings - Fork14
CDP command line interface (CLI)
License
cloudera/cdpcli
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This package provides a unified command line interface to the Cloudera DataPlatform (CDP) control plane API.
- Python 3.6 or higher
Earlier versions of Python are no longer supported for new releases, as ofJanuary 2021. Previous CLI releases shall continue to work under earlier Pythonversions.
Starting with version 0.9.24, the requests and urllib3 libraries are no longerbundled with the CLI. When upgrading, watch for those new dependencies to beinstalled.
To install usingpip
from thecdpcli PyPI project:
$ pip install cdpcli
To install from source:
$ git clone git@github.com:cloudera/cdpcli.git$ cd cdpcli$ pip install .
An alternative CLI exposing beta functionality is available in its own package.
$ pip install cdpcli-beta
Do not install both the regular and beta CLIs in the same Python environment,as they use the same entry points and therefore conflict.
Any features exposed in the beta CLI that are not available in the regular CLIare still under development. They are not yet supported, may not work, and aresubject to change in incompatible ways, including removal. Do not rely on betafeatures for production use.
API calls through the CDP CLI require a key pair issued from the CDP controlplane. Use the CDP console to generate keys, followingdocumentedinstructions.Then, runcdp configure
to provide the credentials to the CLI.
$ cdp configureCDP Access Key ID [None]: xxxCDP Private Key [None]: yyy
Credentials are stored under the "default" profile in$HOME/.cdp/credentials,using the ini file format.
[default]cdp_access_key_id = xxxcdp_private_key = yyy
If you need to access the API as more than one user, set up a named profile foreach user. Each profile stores a separate set of credentials.
$ cdp configure --profile my-other-user
The credentials for a profile are stored in$HOME/.cdp/credentials under asection named for the profile.
An alternative to storing credentials in$HOME/.cdp/credentials is to passthem using the environment variablesCDP_ACCESS_KEY_ID
andCDP_PRIVATE_KEY
.However, these variables are ignored when the--profile
option is used whenrunning the CLI (see below).
The CLI may be used to accessCDP Private Cloudcontrol planes. Contact your control plane administrator to obtain the requiredbase endpoint URL value for your installation. Set the value in$HOME/.cdp/config, another configuration file that uses the ini file format.Create a section named for the profile which should work with the private cloudcontrol plane.
[profile private1]cdp_endpoint_url = https://cdp-private.example.com
The CLI guesses whether it is using CDP Public Cloud or CDP Private Cloud basedon the base endpoint URL. If you find that it is guessing incorrectly, you canconfigure use of eitherform factor in$HOME/.cdp/config. Valid form factorvalues are "public" and "private".
[profile private1]form_factor = private
Basic syntax:
cdp [options] <command> <subcommand> [parameters]
Examples:
$ cdp iam get-user$ cdp environments describe-environments --environment-name myenv1
For general help, use any of these commands.
$ cdp help$ cdp --help$ cdp # no arguments
Most CLI commands correspond to API services. Subcommands correspond tooperations in services.
- For help on any command, run its
help
subcommand, or pass the--help
parameter. - For help on any subcommand, pass the
help
or--help
parameter.
The same help content is available in onlineAPI documentation.
By default, the CLI uses credentials in the "default" profile. Use a differentprofile by passing the--profile
option.
$ cdp --profile my-other-user iam get-user
By default, the CLI works withCDP Public Cloudand calculates API endpoints accordingly. If you are using CDP Private Cloud, besure to provide the base endpoint URL for your private cloud control plane. Youcan do so by setting it in$HOME/.cdp/config for the desired profile, orthrough the--endpoint-url
option, which supersedes the configuration.
$ cdp --endpoint-url https://other.cdp-private.example.com ...
The CLI guesses whether it is using CDP Public Cloud or CDP Private Cloud basedon the base endpoint URL. If you find that it is guessing incorrectly, you canforce use of eitherform factor by either setting it in$HOME/.cdp/configfor the desired profile, or through the--form-factor
option, which supersedesthe configuration. Specifying a form factor does not alter the base endpoint URLin use.
$ cdp --form-factor private ...
The CDP CLI is licensed under theApache License, Version 2.0with asupplemental license disclaimer.
About
CDP command line interface (CLI)