#!/bin/bash
set -euo pipefail

# The test server owns this disposable registry endpoint.
endpoint="http://127.0.0.1:3001"
case "${2:-}" in
  alpha|beta) ;;
  *) exit 64 ;;
esac
case "${1:-}" in
  list) /usr/bin/curl -q -fsS --max-time 5 "$endpoint/$2/list" ;;
  inspect) /usr/bin/curl -q -fsS --max-time 5 "$endpoint/$2/inspect" ;;
  delete) /usr/bin/curl -q -fsS --max-time 5 -X DELETE "$endpoint/$2/obsolete" ;;
  *) exit 64 ;;
esac
