$ npm install -g anypoint-cli@2.3.2
Anypoint CLI 2.x
Anypoint Platform provides a scripting and command line tool for both Anypoint Platform and Anypoint Platform Private Cloud Edition. The CLI supports both interactive shell and standard CLI modes, and works with:
-
Runtime Manager for Mule applications deployed to CloudHub (hosted by MuleSoft) and customer-hosted Mule runtimes
Prerequisites
-
Download and install NodeJS and npm (node package manager) on your system.
See the NodeJS download page.
-
Download and install the Git version management system on your system.
See the Git download site.
Installation
Depending on the configuration of your system, you might need to run these commands using administrator credentials.
If the installation command fails with the following error, ensure that the Git client is installed on your computer and the git protocol is not blocked by your firewall or network:
fatal: read error: Invalid argument
If the git protocol is blocked, you can configure Git to use https://
instead of git://
:
git config --global url."https://".insteadOf git://
Reference
Every instance of Anypoint-CLI takes any of the following options:
Parameter | Description | Required |
---|---|---|
username |
Your Anypoint Platform username. You can also pass this value using a the environment variable |
Yes |
password |
Your Anypoint Platform password. You can also pass this value using the environment variable |
Yes |
organization |
Your organization within Anypoint Platform. You can also pass this value using the environment variable ` export ANYPOINT_ORG=<name>` |
No |
environment |
Your Anypoint environment. You can also pass this value using the environment variable |
No |
host |
The host of your Anypoint Platform Installation. You can also pass this value using a dedicated environment variable |
No |
bearer |
Instead of passing your username and password, you can choose to pass the token for your account. Your session expires when the token bearer expires. |
No |
Usage
Keep the following in mind while using the Anypoint CLI:
-
Environment variables override credentials file parameters and command-line parameters override environment variables.
If you don’t pass a command-line parameter, the default profile properties are used. -
If not specified, the default environment is production.
-
Your Anypoint session expires based on the Default session timeout configured in your Root Organization settings.
For information about your Root Organization settings, see Manage Root Organization Settings.
-
The Anypoint CLI works with autocomplete.
You can start typing the name of the command or parameter and press Tab for autocomplete or press Tab+Tab for a list of options.
Credentials File
The recommended way of passing these options to your Anypoint Platform CLI installation is using the credentials
file located inside the ./anypoint/
directory, which is not automatically created during installation. Follow these steps to create your credentials file:
-
Create a directory called
.anypoint
in the~/
directory for Linux and OSx, orC:\Users\USERNAME \
in Windows. -
Navigate to your
.anypoint
directory and create a blank file namedcredentials
with the following structure:{ "default": { "username": "yourAnypointUserName", "password": "yourAnypointPassword", "organization": "", "environment": "", "host": "" }, "otherProfile": { "username": "", "password": "", "organization": "", "environment": "", "host": "" } }
Note that the "default" profile is used unless the
ANYPOINT_PROFILE
environment variable is set:> export ANYPOINT_PROFILE="otherProfile" > anypoint-cli
Then run the anypoint-cli command without any options:
> anypoint-cli
Dedicated Environment Variables
If you choose to pass the credentials when running Anypoint-CLI, we strongly recommend passing both parameters as environment variables: ANYPOINT_USERNAME
and ANYPOINT_PASSWORD
.
> export ANYPOINT_USERNAME="username"
> export ANYPOINT_PASSWORD="password"
> anypoint-cli
CLI Options
As instructed above, the username and password parameters are required. However, if you choose to pass your username, Anypoint Platform CLI prompts for your password.
> anypoint-cli --username="user"
Password: ****
Pass Commands
After setting up a proper way to access Anypoint Platform from the CLI, you can start passing commands.
See Anypoint CLI 2.x List of Commands for instructions on how to use them.
Use Anypoint CLI Through a Network Proxy
To use Anypoint CLI through a proxy server, configure the HTTP_PROXY
and HTTPS_PROXY
environment variables with the hostname or IP addresses for your proxy servers.
Depending on your operating system, use the following commands:
-
Linux, macOS, or Unix
$ export HTTP_PROXY=http://proxy-server:80
$ export HTTPS_PROXY=https://proxy-server:443
-
Windows
> set HTTP_PROXY=http://proxy-server:80
> set HTTPS_PROXY=https//proxy-server:443
If the proxy server requires authentication, use these commands:
-
Linux, macOS, or Unix
$ export HTTP_PROXY=http://username:password@proxy-server:80
$ export HTTPS_PROXY=https://username:password@proxy-server:443
-
Windows
> set HTTP_PROXY=http://username:password@proxy-server:80
> set HTTPS_PROXY=https://username:password@proxy-server:443