feat: add ops center and node onboarding flow
This commit is contained in:
55
domain-api/deploy/multi-region/check_ops_contracts.sh
Executable file
55
domain-api/deploy/multi-region/check_ops_contracts.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
BASE_URL="${1:-http://127.0.0.1:8100}"
|
||||
|
||||
contracts_json="$(curl -fsS "${BASE_URL}/api/v1/ops/contracts")"
|
||||
|
||||
echo "[1/3] ops contracts registry"
|
||||
printf '%s\n\n' "${contracts_json}"
|
||||
|
||||
echo "[2/3] condensed summary"
|
||||
python3 - <<'PY' "${contracts_json}"
|
||||
import json
|
||||
import sys
|
||||
|
||||
payload = json.loads(sys.argv[1])
|
||||
data = payload.get("data") or {}
|
||||
contracts = list(data.get("contracts") or [])
|
||||
|
||||
summary = {
|
||||
"registry_version": str(data.get("registry_version") or ""),
|
||||
"schema_version": str(data.get("schema_version") or ""),
|
||||
"contracts_total": len(contracts),
|
||||
"contract_keys": [str(item.get("key") or "") for item in contracts if str(item.get("key") or "")],
|
||||
"docs_root": str(data.get("docs_root") or ""),
|
||||
"discovery_entrypoints": list(data.get("discovery_entrypoints") or []),
|
||||
}
|
||||
|
||||
print(json.dumps(summary, ensure_ascii=False, indent=2))
|
||||
PY
|
||||
echo
|
||||
|
||||
echo "[3/3] contract rows"
|
||||
python3 - <<'PY' "${contracts_json}"
|
||||
import json
|
||||
import sys
|
||||
|
||||
payload = json.loads(sys.argv[1])
|
||||
data = payload.get("data") or {}
|
||||
contracts = list(data.get("contracts") or [])
|
||||
|
||||
rows = [
|
||||
{
|
||||
"key": str(item.get("key") or ""),
|
||||
"version": str(item.get("version") or ""),
|
||||
"status": str(item.get("status") or ""),
|
||||
"primary_endpoint": str(item.get("primary_endpoint") or ""),
|
||||
"schema_doc_path": str(item.get("schema_doc_path") or ""),
|
||||
"consumers": list(item.get("consumers") or []),
|
||||
}
|
||||
for item in contracts
|
||||
]
|
||||
|
||||
print(json.dumps(rows, ensure_ascii=False, indent=2))
|
||||
PY
|
||||
Reference in New Issue
Block a user