14.9. User management via CLI

Cloud Pipeline CLI has to be installed. See 14. Command-line interface (CLI).

Batch import

pipe CLI offers the same options to import the users from a CSV file as it can be performed via GUI.

Command to import users from CSV file:

pipe users import [OPTIONS] FILE_PATH

Where FILE_PATH - defines a path to the CSV file with users list

Possible options:

Options Description
Non-required options
-cu / --create-user Allows new user creation
-cg / --create-group Allows new group creation
-cm / --create-metadata <KEY> Allows to create a new metadata with specified key. Multiple options supported

To mimic the GUI scenario, described here, the following command will be used (it imports an example CSV and allows creation of any object, that does not exist yet):

pipe users import   --create-user \
                    --create-group \
                    --create-metadata billing-center \
                    --create-metadata import_attr1 \
                    ~/import-test.csv

During the execution - pipe command prints detailed logs, regarding the operations, which were performed and how the CSV was parsed:

[INFO] User 'IMPORT_USER1' successfully created.
[INFO] Role 'ROLE_IMPORT_GROUP1' successfully created.
[INFO] Role 'ROLE_IMPORT_GROUP1' successfully assigned to user 'IMPORT_USER1'.
[INFO] A new metadata 'billing-center'='Center1' added to user 'IMPORT_USER1'.
[INFO] A new metadata 'billing-group'='Group1' added to user 'IMPORT_USER1'.
[INFO] A new metadata 'import_attr1'='import_attr1_val1' added to user 'IMPORT_USER1'.
[INFO] User 'IMPORT_USER2' successfully created.
[INFO] Role 'ROLE_IMPORT_GROUP2' successfully created.
[INFO] Role 'ROLE_IMPORT_GROUP2' successfully assigned to user 'IMPORT_USER2'.
[INFO] A new metadata 'billing-center'='Center1' added to user 'IMPORT_USER2'.
[INFO] A new metadata 'billing-group'='Group1' added to user 'IMPORT_USER2'.
[INFO] A new metadata 'import_attr1'='import_attr1_val2' added to user 'IMPORT_USER2'.
[INFO] User 'IMPORT_USER3' successfully created.
[INFO] Role 'ROLE_IMPORT_GROUP1' successfully assigned to user 'IMPORT_USER3'.
[INFO] Role 'ROLE_IMPORT_GROUP2' successfully assigned to user 'IMPORT_USER3'.
[INFO] A new metadata 'billing-center'='Center2' added to user 'IMPORT_USER3'.
[INFO] A new metadata 'billing-group'='Group1' added to user 'IMPORT_USER3'.
[INFO] A new metadata 'import_attr1'='import_attr1_val3' added to user 'IMPORT_USER3'.

To view results see here. They will be the same as on GUI.

Instances usage

Via the pipe CLI users can view count of instances running by them at the moment.
The general command to perform this operation:

pipe users instances [OPTIONS]
Options Description
Non-required options
-v / --verbose Shows all user's active restrictions by the instances count in a table view

This command will show:

  • summary number of instances running by the user at the moment (including cluster's worker nodes)
  • the configured restriction by the instances count (i.e. maximal count of the instances that current user can launch simultaneously).
    By default, without -v option, only the restriction with the highest priority will be shown.

Example of the command outputs:
CP_InstancesUsageViaCLI
CP_InstancesUsageViaCLI

For more details about user's restrictions by the launched instances count see here.