Cloud Pipeline CLI has to be installed. See 14. Command-line interface (CLI).
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.