Add ak-gatekeeper

This commit is contained in:
2024-10-08 16:41:52 +02:00
parent 47776ea7bf
commit 5dbc3bdea2
9 changed files with 262 additions and 0 deletions

View 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