Getting Started with the CLI

Overview

Control Plane offers a Command Line Interface (CLI) for all major operating systems. The CLI is an abstraction layer over the Control Plane API and give you access to all the features of the platform.

It is recommended to install the CLI in order to perform a handful of operations that are not available from the console (e.g., containerizing an microservice).

This quick start will demonstrate how to:

  • Install the CLI
  • Log in to the CLI
  • Display the the Control Plane resources created in the previous quick start
  • Set a default org and GVC in your profile

Prerequisites

Step One - Install the CLI

The preferred method to install the CLI is using npm with Node.js version 12+. An alternate method to install the CLI is available here.

After installing npm, open a new shell windows and execute the following command to install the CLI:

copy
npm install -g @controlplane/cli

After a successful installation, run the following command to view the installed version:

copy
cpln --version

The latest version can be viewed here and cross referenced with the output from the --version flag.

Step Two - Log in to the CLI

The CLI requires you to be logged in before calling any commands.

Open a new shell and run this command to log in:

copy
cpln login

A browser windows will open with the credentials page. After a successful log in, the window can be closed. The shell will show that a default profile has been created and is mapped to your email.

Step Three - Display Control Plane Resources

You can use the CLI to view the resources that were created in the previous quick start.

Run the commands below to view their respective output (substitute ORG_NAME and GVC_NAME for your org and GVC name):

Get your orgs
copy
cpln org get
Get all your GVCs
copy
cpln gvc get --org ORG_NAME
Get all your workloads
copy
cpln workload get --org ORG_NAME --GVC GVC_NAME

To view all the commands that the CLI offers, run:

copy
cpln --help

Each command displayed in the --help output also has a --help output. To view, run:

copy
cpln COMMAND --help

Step Four - Set a default org and GVC

Notice that in step 3 the get GVC and workload commands required additional flags for the org and GVC.

By setting a default org and/org GVC on your profprofileile, those flags will not be needed in future calls to any CLI command.

To set a default org or GVC, run the following command (substitute ORG_NAME and GVC_NAME for your org and GVC name):

copy
cpln profile update default --org ORG_NAME --gvc GVC_NAME

Summary

By installing the CLI, you have the ability to easily interact with the platform and execute commands quickly.

Visit the CLI documentation page for details and examples of each command.

Copyright © 2021 Control Plane Corporation. All rights reserved. Revision 30221ec6
Contents