60 lines
1.0 KiB
Bash
60 lines
1.0 KiB
Bash
#!/bin/bash
|
|
#
|
|
# Example API call script for Die Mobiliar
|
|
# v0.2 - James Pattinson - August 2021
|
|
#
|
|
# Deletes an Oracle Live Mount
|
|
#
|
|
# usage: oracle_delete_mount.sh [-nf] <id>
|
|
#
|
|
# -n do not wait for completion, submit job only
|
|
# -f force unmount
|
|
|
|
MYDIR="$(dirname "$(realpath "$0")")"
|
|
# source $MYDIR/rbk_api.conf
|
|
source $MYDIR/oracle_funcs.sh
|
|
|
|
force=0
|
|
|
|
usage() { echo "Usage: $0 [-n][-f] <mount id>" 1>&2; exit 1; }
|
|
|
|
while getopts "nf" o; do
|
|
case "${o}" in
|
|
n)
|
|
nowait=1
|
|
;;
|
|
f)
|
|
force=true
|
|
;;
|
|
*)
|
|
usage
|
|
;;
|
|
esac
|
|
done
|
|
shift $((OPTIND-1))
|
|
|
|
if [ $# -ne 1 ]; then
|
|
usage
|
|
fi
|
|
|
|
id=$1
|
|
|
|
echo Connecting to Rubrik with IP $RUBRIK_IP
|
|
|
|
# API call to remove Oracle Live Mount
|
|
if [ $force == "true" ]; then
|
|
ENDPOINT="https://$RUBRIK_IP/api/internal/oracle/db/mount/$id?force=true"
|
|
else
|
|
ENDPOINT="https://$RUBRIK_IP/api/internal/oracle/db/mount/$id"
|
|
fi
|
|
|
|
echo Starting job to delete Live Mount with ID $id
|
|
|
|
rest_api_delete
|
|
|
|
# Check the status in a loop
|
|
ENDPOINT=$(cat /tmp/rbkresponse.$$ | jq -r '.links[0].href')
|
|
check_status
|
|
|
|
cleanup
|