Prerequisites:
- Have Jet Stream user privileges.
- Know the bookmark you would like to share.
Jet Stream administrators can use this CLI cookbook recipe to share a bookmark on Jet Stream using the Delphix Engine CLI.
The following script is for educational and demonstration purposes only and is not supported by Delphix.
This script can be downloaded by selecting shareBookmark.sh.
Sharing a bookmark in Jet Stream
#!/bin/bash # A sample script for calls to the CLI. This one shares Bookmark across containers in same template. # # VERY IMPORTANT: In order for this to work, you need to go through the steps here: # https://docs.delphix.com/display/DOCS/CLI+Cookbook%3A+Configuring+Key-Based+SSH+Authentication+for+Automation # After this you will not need to use a username and password to log into the delphix engine. If you do not # setup the SSH authentication you will have to manually enter the password. # ##examples## # Share Bookmark #./shareBookmark.sh -a share JS_BOOKMARK-75 # Unshare Bookmark #./shareBookmark.sh -a unshare JS_BOOKMARK-75 ##### Constants # Describes a Delphix software revision. VERSION="1.6.2" ##### Default Values. These can be overwriten with optional arguments. engine="10.0.1.10" username="dev" ##### Functions # Help Menu function usage { echo "Usage: shareBookmark.sh [[-h] | options...] -a share/unshare <bookmarkName>" echo "Share/Unshare JetStream bookmark" echo "" echo "Positional arguments" echo "bookmarkName. Format: JS_BOOKMARK-<n>" echo "" echo "Optional Arguments:" echo " -h Show this message and exit" echo " -d Delphix engine IP address or host name, otherwise revert to default" echo " -u Server user. Password needs to manually provide at run time, otherwise revert to default" echo " -a action to perform on bookmark. Type:String. Values:share/unshare" } # Create Our Session, including establishing the API version. function create_session { echo "creating session..." SSH_CMD="ssh ${username}@${engine}" ${SSH_CMD} "version $VERSION" check_result } # Check the result of the curl. If there are problems, inform the user then exit. function check_result { exitStatus=$? if [ $exitStatus -ne 0 ] then echo "command failed with exit status $exitStatus" echo $result exit 1 fi } function bookmark_action { # Change share mode of bookmark echo "Changing share mode.." if [[ $action = "share" ]] then paramString="jetstream bookmark select $bookmarkName share; commit;" elif [[ $action = "unshare" ]] then paramString="jetstream bookmark select $bookmarkName unshare; commit;" else usage exit 1 fi result=$(${SSH_CMD} $paramString) check_result if [[ $action = "share" ]] then echo "Bookmark ${bookmarkName} is now in shared mode" elif [[ $action = "unshare" ]] then echo "Bookmark ${bookmarkName} is now in not-share mode" fi } ##### Main while getopts "u:d:a:h" flag; do case "$flag" in u ) username=${OPTARG%:*} ;; d ) engine=$OPTARG ;; a ) action=$OPTARG ;; h ) usage exit ;; * ) usage exit 1 esac done # Shift the parameters so we only have the positional arguments left shift $((OPTIND-1)) # Check that there is 1 positional arguments if [ $# != 1 ] then usage exit 1 fi # Get the one positional arguments bookmarkName=$1 create_session bookmark_action