37 lines
1.2 KiB
Bash
Executable File
37 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
if (( $# != 3 )); then
|
|
echo "usage: $0 <cache/cache group> <cache pattern> <token type>"
|
|
exit 1
|
|
fi
|
|
|
|
cache="$1"
|
|
cache_pattern="$2"
|
|
token_type="$3"
|
|
|
|
case $token_type in
|
|
"cache-creator")
|
|
atticd-atticadm make-token --sub "$cache-cache-creator" --validity "1y" \
|
|
--pull "$cache_pattern" --push "$cache_pattern" --delete "$cache_pattern" \
|
|
--create-cache "$cache_pattern" --configure-cache "$cache_pattern" \
|
|
--configure-cache-retention "$cache_pattern" --destroy-cache "$cache_pattern"
|
|
;;
|
|
"admin")
|
|
atticd-atticadm make-token --sub "$cache-admin" --validity "1y" --pull "$cache_pattern" \
|
|
--push "$cache_pattern" --configure-cache "$cache_pattern" \
|
|
--configure-cache-retention "$cache_pattern"
|
|
;;
|
|
"writer")
|
|
atticd-atticadm make-token --sub "$cache-writer" --validity "1y" --pull "$cache_pattern" \
|
|
--push "$cache_pattern"
|
|
;;
|
|
"reader")
|
|
atticd-atticadm make-token --sub "$cache-reader" --validity "1y" --pull "$cache_pattern"
|
|
;;
|
|
*)
|
|
echo "invalid token type: $token_type"
|
|
echo "available options: cache-creator, admin, writer, reader"
|
|
exit 1
|
|
;;
|
|
esac
|