Administer Watson Studio Local from the command line
You can automate some Watson Studio Local administration tasks using the command line interface (CLI).
- Onboarding a new user in Watson Studio Local and associate them with the appropriate set of projects.
- Removing users and all of their associated assets from Watson Studio Local.
- Managing assets in a continuous integration/continuous delivery pipeline. For example, take assets built by a data scientist and move them through test and production environments.
- Developing custom solutions for your organization's needs.
- Monitoring the health of your clusters and notifications are provided when pods are down, such as dsx-core/usermgmt.
To use the command line interface for Watson Studio Local, download the package from https://www-01.ibm.com/marketing/iwm/iwm/web/dispatcher.do?source=mrs-ibmdselt.
- Java 8 runtime environment (64-bit)
Installing the CLI
To install the command line interface:
- Unzip WSCLI.zip to extract the contents of the directory.
- From a command prompt, change to the WSCLI directory. For example, on
- To view a list of available commands, type:
which returns help for each command. For example:
$ ./wscli -h NAME wscli <command> DESCRIPTION WS command-line interface AVAILABLE COMMANDS USER MANAGEMENT add user Adds the user to Watson Studio get user Returns the user information list users Returns the list of users in Watson Studio edit user Edits the Watson Studio user delete user Deletes the user in Watson Studio add collaborator Adds the user as a collaborator to the project, with the specific role list collaborators Returns the list of collaborators in the project edit collaborator Changes the user role as a collaborator in the project delete collaborator Removes the user's access to the project as a collaborator reset password Reset the user's password. Can only be run by Admin User get token Returns the authorization token for the user
Supplying credentials for CLI
- --cluster-host (-ch)
- --auth-user (-au)
- --auth-password (-ap)
https://cluster-host-name.domain.com https://220.127.116.11 cluster-host-name.domain.com 18.104.22.168
If you do not want to provide these credential parameters for every command, set them using environment variables.
- From a command prompt, run the
- vi setupEnv.sh
- Edit the following fields to supply your
export WS_CLUSTER_IP="<ws-cluster-host-or-ip>" export WS_AUTH_USER="<ws-admin-user-name>" export WS_AUTH_PWD="<ws-admin-user-password>"
- Save the changes:
Alternatively, you can retrieve a bearer token for your user credentials and store that in the
WS_AUTH_TOKEN environment variable. When this variable is populated, CLI ignores
the values for
- Run this command to retrieve the
WS_AUTH_TOKEN=`curl -k -X GET <CLUSTER_HOST>/v1/preauth/validateAuth -u <username>:<password> | jq -r '.accessToken'`
- Run the utility script getToken.sh to store the
Using optional parameters with CLI
Optional parameters include:
OPTIONAL PARAMETERS: -json --json Provides the command output in JSON format Default: false Common: -debug --debug Provides additional debug content for IBM Support Default: false -h --help Displays the command reference help -rs --result-status Shows the command execution status and time before the final command result output Default: false -v --verbose Provides detailed command execution output messages Default: false