github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/scripts/s3/delete-bucket-inventory.sh (about) 1 #!/bin/bash 2 3 while getopts n:b: flag 4 do 5 case "$flag" in 6 n) ID=${OPTARG};; 7 b) BUCKET=${OPTARG};; 8 esac 9 done 10 11 print_usage() { 12 echo "Usage:" 13 echo "./delete-bucket-inventory -b BUCKET_NAME [-n INVENTORY_NAME]" 14 echo 15 echo "The script disables periodical inventory generation for a bucket." 16 echo 17 echo " BUCKET_NAME - AWS bucket name for which inventory will be enabled" 18 echo " INVENTORY_NAME - is AWS inventory ID" 19 } 20 21 RED='\033[0;31m' 22 NC='\033[0m' 23 24 if [[ -z "${BUCKET}" ]]; then 25 printf "${RED}Error${NC}: bucket name is not defined.\n" 26 print_usage 27 exit 1 28 fi 29 30 if [[ -z "${ID}" ]]; then 31 ID="${BUCKET}" 32 fi 33 34 aws s3api delete-bucket-inventory-configuration --bucket ${BUCKET} --id ${ID}