|
|
|
|
@ -1,11 +1,10 @@
|
|
|
|
|
#!/bin/sh
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
CURL="/usr/bin/curl"
|
|
|
|
|
CREDS="$HOME/.ngcp-api"
|
|
|
|
|
TOOLS="/usr/bin/ngcp-api-tools"
|
|
|
|
|
test -f "$TOOLS" && . "$TOOLS"
|
|
|
|
|
TOOLS="/usr/share/ngcp-panel-tools/ngcp-api.inc"
|
|
|
|
|
|
|
|
|
|
usage () {
|
|
|
|
|
cat << EOF
|
|
|
|
|
cat << EOF
|
|
|
|
|
Usage: $0 [OPTIONS] <url>
|
|
|
|
|
|
|
|
|
|
sends a patch request to NGCP REST API
|
|
|
|
|
@ -16,11 +15,17 @@ OPTIONS:
|
|
|
|
|
-f read the input info from a file instead of read stdin
|
|
|
|
|
-m use Header 'Refer: return=minimal'
|
|
|
|
|
EOF
|
|
|
|
|
exit 1
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test -z "$APIUSER" && -f "$TOOLS" && importcreds
|
|
|
|
|
test -z "$APIUSER" && APIUSER="administrator:administrator"
|
|
|
|
|
if [ -z "$APIUSER" ] ; then
|
|
|
|
|
if [ -f "$TOOLS" ] ; then
|
|
|
|
|
source "$TOOLS"
|
|
|
|
|
importcreds
|
|
|
|
|
else
|
|
|
|
|
APIUSER="administrator:administrator"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
INPUT="-T -"
|
|
|
|
|
CTYPE="application/json-patch+json"
|
|
|
|
|
PREFER="representation"
|
|
|
|
|
@ -53,7 +58,9 @@ done
|
|
|
|
|
shift $(($OPTIND - 1))
|
|
|
|
|
|
|
|
|
|
URL="$1"
|
|
|
|
|
test -z "$URL" && usage;
|
|
|
|
|
if [ -z "$URL" ] ; then
|
|
|
|
|
usage
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
${CURL} -i ${VERBOSE} -X PATCH \
|
|
|
|
|
-H 'Connection: close' -H "Prefer: return=$PREFER" \
|
|
|
|
|
|