amphorae-image-audit.sh 667 B

123456789101112131415161718192021222324252627282930
  1. #! /bin/bash
  2. usage() {
  3. cat << EOF
  4. Usage: ${0##*/} [-h] <image>
  5. Lists amphorae using a given image
  6. -h Print this help
  7. EOF
  8. }
  9. while getopts h opt; do
  10. case $opt in
  11. h) usage; exit 0 ;;
  12. esac
  13. done
  14. shift $(( OPTIND - 1 ))
  15. if [[ $# -ne 1 ]]; then
  16. 2>&1 usage
  17. exit 1
  18. fi
  19. . ~/.os_helpers
  20. endpoint="$(get_service_endpoint load-balancer)"
  21. curl -s -H "X-Auth-Token: $CURL_OS_TOKEN" "${endpoint}"'/v2.0/octavia/amphorae?image_id='"${1}"'&fields=id&fields=loadbalancer_id&fields=status' \
  22. | jq -r '["-----", "-----", "-----"], (.amphorae[] | [.id, .loadbalancer_id, .status]) | @tsv' \
  23. | column --table-columns id,loadbalancer_id,status -o' | ' -t