Açıklama Yok

create-shuffle-mvp-workflows.sh 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. SHUFFLE_BASE_URL="${SHUFFLE_BASE_URL:-http://localhost:5001}"
  4. SHUFFLE_API_KEY="${SHUFFLE_API_KEY:-}"
  5. if [[ -z "${SHUFFLE_API_KEY}" ]]; then
  6. echo "error: SHUFFLE_API_KEY is required"
  7. echo "example: SHUFFLE_API_KEY=xxxx scripts/create-shuffle-mvp-workflows.sh"
  8. exit 1
  9. fi
  10. create_workflow() {
  11. local name="$1"
  12. local description="$2"
  13. local payload
  14. payload=$(cat <<JSON
  15. {
  16. "name": "${name}",
  17. "description": "${description}"
  18. }
  19. JSON
  20. )
  21. local response
  22. response=$(curl -sS -X POST "${SHUFFLE_BASE_URL}/api/v1/workflows" \
  23. -H "Authorization: Bearer ${SHUFFLE_API_KEY}" \
  24. -H "Content-Type: application/json" \
  25. -d "${payload}")
  26. WORKFLOW_RESPONSE="${response}" python3 - <<'PY'
  27. import json, os, sys
  28. raw = os.environ.get("WORKFLOW_RESPONSE", "")
  29. try:
  30. data = json.loads(raw)
  31. except Exception:
  32. print("error: invalid response")
  33. print(raw[:400])
  34. sys.exit(1)
  35. if isinstance(data, dict) and data.get("success") is False:
  36. print("error: workflow create failed")
  37. print(raw)
  38. sys.exit(1)
  39. print(f"created: {data.get('name')} id={data.get('id')}")
  40. PY
  41. }
  42. create_workflow \
  43. "MVP - IOC Enrichment and Case Routing" \
  44. "Proposal-aligned MVP workflow: IOC enrichment, confidence scoring, callback to soc-integrator, incident routing to IRIS/PagerDuty stub."
  45. create_workflow \
  46. "MVP - VPN Geo Anomaly Triage" \
  47. "Proposal-aligned MVP workflow: detect successful VPN auth from outside TH, enrich context, risk branch, callback for incident handling."