Add ak-gatekeeper
This commit is contained in:
21
ak-gatekeeper/outpost_read.sh
Normal file
21
ak-gatekeeper/outpost_read.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
CURL_OPTIONS="-sL"
|
||||
if [ ! -z ${INSECURE_CURL+x} ]; then
|
||||
CURL_OPTIONS="${CURL_OPTIONS} -k"
|
||||
fi
|
||||
OUTPUT_FILE=$(mktemp)
|
||||
HTTP_CODE=$(curl $CURL_OPTIONS \
|
||||
--output $OUTPUT_FILE \
|
||||
--write-out "%{http_code}" \
|
||||
-H "Accept: application/json" \
|
||||
-H "Authorization: Bearer ${AK_TOKEN}" \
|
||||
"${AK_BASEURL}/api/v3/outposts/instances/${AK_OUTPOST_ID}/")
|
||||
if [[ ${HTTP_CODE} -lt 200 || ${HTTP_CODE} -gt 299 ]] ; then
|
||||
>&2 cat $OUTPUT_FILE
|
||||
rm $OUTPUT_FILE
|
||||
exit 2
|
||||
fi
|
||||
cat | jq -r ".results"
|
||||
rm $OUTPUT_FILE
|
||||
Reference in New Issue
Block a user