Files
scadaproj/docs/deploy/2026-11-22-prod-cvd-content/apply-api-methods.sh
T
Joseph Doherty 1ab2bca41d deploy(prod): CVD reactor content (Phase 7) — QA→PROD templates, API methods, BTDB, Z28061–Z28069 on site-par; mxgw SQL login + PAR NewJersey alarms
Plan docs/plans/2026-11-22-prod-cvd-content-copy.md with the QA findings, the hierarchical-name
binding remap (QA and PROD reuse Galaxy suffixes for different machines), BT checks, the run
status and the QA reactor disable. Generated inputs under docs/deploy/2026-11-22-prod-cvd-content/
(bindings, alarm-source overrides, mapping, QA export, BT preflight SQL, helper scripts; no secrets).
PROD plan §0.1a rows for the content run and the mxgw changes.

Claude-Session: https://claude.ai/code/session_01GT67AD5mc2BnaaAfY3hqqQ
2026-11-22 12:06:04 -05:00

25 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# Create the inbound API methods on PROD from qa-export/api-methods.json (QA definitions, 2026-11-22).
# Same name, script, timeout, parameter and return definitions, and traceAllCalls as QA.
# The bundle route is blocked by the import reference-scanner false positive (System./Array.), hence the CLI.
# usage: apply-api-methods.sh <sbp-wrapper> [--dry] [--include-legacy]
# --include-legacy also creates IpsenMESMoveIn (no calls on QA in 30 days; excluded by default).
set -euo pipefail
SBP=$1; shift; DRY=0; LEGACY=0
for a in "$@"; do case $a in --dry) DRY=1;; --include-legacy) LEGACY=1;; esac; done
J="$(cd "$(dirname "$0")" && pwd)/qa-export/api-methods.json"
python3 - "$J" "$LEGACY" <<'PY' | while IFS= read -r name; do
import json,sys
for m in json.load(open(sys.argv[1])):
if m['name']=='IpsenMESMoveIn' and sys.argv[2]!='1': continue
print(m['name'])
PY
field(){ python3 -c "import json,sys;m=[x for x in json.load(open('$J')) if x['name']=='$name'][0];v=m['$1'];print(v if v is not None else '',end='')"; }
args=(api-method create --name "$name" --script "$(field script)" --timeout "$(field timeoutSeconds)")
p=$(field parameterDefinitions); [ -n "$p" ] && args+=(--parameters "$p")
r=$(field returnDefinition); [ -n "$r" ] && args+=(--return-def "$r")
[ "$(field traceAllCalls)" = True ] && args+=(--trace-all-calls)
if [ $DRY = 1 ]; then echo "would create $name (timeout $(field timeoutSeconds)s)"; else echo "== $name"; "$SBP" "${args[@]}"; fi
done
[ $DRY = 1 ] || "$SBP" api-method list | python3 -c "import json,sys;[print(m['id'],m['name'],m['timeoutSeconds']) for m in json.load(sys.stdin)]"