diff --git a/scripts/destroy_resources.sh b/scripts/destroy_resources.sh index 4bf23e3..62c80e9 100755 --- a/scripts/destroy_resources.sh +++ b/scripts/destroy_resources.sh @@ -76,12 +76,66 @@ run() { fi } +# --- Vertex AI Feature Store REST helpers --- +# `gcloud ai feature-online-stores` is beta-only and absent from a stock gcloud +# install, so it can't be used here: it exits 2 ("Invalid choice") and a +# `if gcloud ... 2>/dev/null` guard silently misreads that as "doesn't exist", +# leaving a Bigtable node billing forever. Creation already goes straight to the +# REST API via the Python SDK (feature_store/setup.py), so deletion does too. +FS_API="https://${FS_REGION}-aiplatform.googleapis.com/v1" +FS_PARENT="projects/${PROJECT_ID}/locations/${FS_REGION}" + +fs_curl() { # fs_curl -> body on stdout, HTTP status as exit-code proxy + curl -sS -X "$1" \ + -H "Authorization: Bearer $(gcloud auth print-access-token --project="$PROJECT_ID")" \ + -H "Content-Type: application/json" \ + -w '\n%{http_code}' "$2" +} + +# fs_get — succeeds only on HTTP 200; prints the body. +fs_get() { + local out status + out=$(fs_curl GET "$1") || return 1 + status=$(printf '%s' "$out" | tail -n1) + [ "$status" = "200" ] || return 1 + printf '%s' "$out" | sed '$d' +} + +# fs_delete