Skip to content
Rishabh Tulsian edited this page Feb 23, 2017 · 5 revisions

Introduction to the Predix CLI - Beta release

The Predix CLI is a wrapper over the CF CLI. It's intended to augment the CF CLI and simplify the common tasks a user performs on the Predix Cloud. We looked at the common pain points for the users and designed some commands to simplify those tasks. Let's just dive into the details of these commands.

What does it do?

Login without having to remember endpoints

When logging into the Predix Cloud you don't have to search/remember the different endpoint URLs. The predix login command prompts you the different PoPs and you just choose one of those

Context based autocomplete for Predix CLI & CF CLI commands and arguments

The Cloud Foundry CLI has a lot of functionality but most of the times users don't remember the order of the arguments or even what they named their apps or service instances. The Predix CLI provides context sensitive autocomplete based on the command and arguments. It can look up orgs, spaces, apps, service instances, services, service plans, etc. So if you were trying to create a new service instance you can lookup the different services and their plans while typing the command itself.

Simplified create-service

A typical service on the catalog requires the issuer id (from the UAA) and you need to add the necessary scope on a client to be able to access it. So the typical steps to create a service and be able to use it are

  1. Create service instance with a trusted issuer id
  2. Lookup required oauth scopes from VCAP properties
  3. Create/update client on the UAA instance with the required scopes

The predix create-service command encapsulates all these steps in a single command

NAME:
   predix create-service - Create a service instance
USAGE:
   predix create-service [command options] SERVICE PLAN SERVICE_INSTANCE <UAA_INSTANCE> <ASSET_INSTANCE> <TIMESERIES_INSTANCE> <ANALYTICS_CATALOG_INSTANCE>
OPTIONS:
   --admin-secret SECRET, -a SECRET                 The admin client SECRET
   --client-id CLIENT-ID, -c CLIENT-ID              The CLIENT-ID to set scopes on
   --client-secret CLIENT-SECRET, -s CLIENT-SECRET  The CLIENT-SECRET for the specified client-id
   --skip-ssl-validation                            Do not attempt to validate the target's SSL certificate
   --ca-cert file                                   Use the given CA certificate file to validate the target's SSL certificate

Lookup service info

The predix service-info command looks up the credentials from the VCAP services info for Predix service instances and presents it in a standardized format. You specify the name of the app and the service instance and it looks up the binding and prints out the credentials from the binding info.

NAME:
   predix service-info - List info for a service instance
USAGE:
   predix service-info APP_NAME SERVICE_INSTANCE

EXAMPLES:
predix service-info sample-app sample-uaa
{
  "issuerId": ...,
  "subdomain": ...,
  "uri": ...,
  "zone": {
    "http-header-name": ...,
    "http-header-value": ...
  }
}

predix service-info sample-app sample-asset
{
  "instanceId": ...,
  "scriptEngine_uri": ...,
  "uri": ...,
  "zone": {
    "http-header-name": ...,
    "http-header-value": ...,
    "oauth-scope": ...
  }
}

UAA CLI

The Predix CLI supports the typical UAAC commands to manage clients and users but instead of targeting a UAA using the URL, you target using the UAA service instance name

NAME:
   predix uaa - Manage Predix UAA instance
USAGE:
   predix uaa command [command options] [arguments...]
COMMANDS:
     login, l    Login and target the specified Predix UAA instance
     target, t   Set or view the targeted Predix UAA instance and context
     targets     Display all Predix UAA targets and contexts
     clients     List client registrations on the targeted Predix UAA instance
     client, cl  Manage clients registered with the targeted Predix UAA instance
     users       List user accounts on the targeted Predix UAA instance
     user, u     Manage user accounts on the targeted Predix UAA instance