{
  "repo": "tidbcloud/devops",
  "binary": "migrate-proxy",
  "binary_path": "cmd/migrate-proxy/main.go",
  "dependencies": {
    "MigrateProxyLifecycle.Startup": {
      "infrastructure": {},
      "services": []
    },
    "MigrateProxyLifecycle.RegisterProxyHooks": {
      "infrastructure": {},
      "services": []
    },
    "MigrateProxyLifecycle.StartHTTPServer": {
      "infrastructure": {
        "http_server": {
          "conditions": [
            "Always"
          ],
          "operations": [
            {
              "operation": "LISTEN",
              "trigger": "Start the migrate-proxy HTTP listener on the configured listen address",
              "conditions": [
                "Always"
              ],
              "implementation": "cmd/migrate-proxy -> server.ListenAndServe()"
            }
          ]
        }
      },
      "services": []
    },
    "Runtime MigrateProxyHTTP.ProxyAll": {
      "infrastructure": {},
      "services": [
        {
          "name": "devops-public-api",
          "target_interface": "ANY https://{proxy-addr}/*",
          "operation_type": "http_proxy",
          "target_repo": "tidbcloud/devops",
          "conditions": [
            "Default branch for all requests"
          ],
          "operations": [
            {
              "operation": "ANY https://{proxy-addr}/*",
              "trigger": "Forward ordinary requests to the public devops endpoint over HTTPS",
              "conditions": [
                "Default branch for all requests"
              ],
              "implementation": "migrate-proxy request hook -> r.URL.Scheme = \"https\"; r.URL.Host = proxyAddr"
            }
          ]
        },
        {
          "name": "devops-internal-api",
          "target_interface": "ANY http://{internal-proxy-addr}/api/v1/devops-internal/*",
          "operation_type": "http_proxy",
          "target_repo": "tidbcloud/devops",
          "conditions": [
            "Only when the path starts with /api/v1/devops-internal"
          ],
          "operations": [
            {
              "operation": "ANY http://{internal-proxy-addr}/api/v1/devops-internal/*",
              "trigger": "Forward internal requests to the internal devops endpoint over HTTP",
              "conditions": [
                "Only when the path starts with /api/v1/devops-internal"
              ],
              "implementation": "migrate-proxy request hook -> if strings.HasPrefix(r.URL.Path, \"/api/v1/devops-internal\") { r.URL.Scheme = \"http\"; r.URL.Host = internalAddr }"
            }
          ]
        }
      ]
    }
  },
  "notes": [
    "The proxy rewrites every request URL before forwarding and adds permissive Access-Control-Allow-* headers on every proxied request."
  ]
}
