{
  "repo": "tidbcloud/api-gateway",
  "binary": "server",
  "binary_path": "ui/cmd/server/main.go",
  "surface_kind": "mixed_service",
  "type": "mixed_service",
  "extensions": {
    "notes": [
      "The binary exposes one Gin API listener on :10000 plus a NoRoute static frontend fallback rooted at frontend/.",
      "dao.init() opens the MySQL GORM handle before main() runs, so database startup is part of the binary lifecycle even though main.go never calls a DB init helper directly.",
      "DELETE /api/v1/route/:routeID only soft-deletes the route row; it does not remove or update Kubernetes ingress objects.",
      "ListNodePortServiceNames currently returns every service name in the namespace because the NodePort filter is commented out."
    ]
  },
  "services": [
    {
      "name": "APIGatewayLifecycle",
      "package": "main",
      "methods": [
        {
          "name": "ParseFlags",
          "name_key": "APIGatewayLifecycle.ParseFlags",
          "input": "-kubeconfig + -master flags",
          "output": "resolved kubeconfig path and master URL overrides",
          "type": "local"
        },
        {
          "name": "ResolveKubeConfig",
          "name_key": "APIGatewayLifecycle.ResolveKubeConfig",
          "input": "in-cluster service account or kubeconfig file path",
          "output": "*rest.Config",
          "type": "local"
        },
        {
          "name": "InitializeDatabase",
          "name_key": "APIGatewayLifecycle.InitializeDatabase",
          "input": "hard-coded MySQL DSN from dao.init()",
          "output": "shared GORM handle",
          "type": "local"
        },
        {
          "name": "InitializeController",
          "name_key": "APIGatewayLifecycle.InitializeController",
          "input": "*rest.Config",
          "output": "kubernetes clientset plus synced namespace/service informer listers",
          "type": "local"
        },
        {
          "name": "StartHTTPServer",
          "name_key": "APIGatewayLifecycle.StartHTTPServer",
          "input": "registered Gin engine",
          "output": "HTTP server listening on :10000",
          "type": "local"
        }
      ]
    },
    {
      "name": "APIGatewayStaticHTTP",
      "type": "http",
      "methods": [
        {
          "name": "ANY /*filepath",
          "name_key": "Runtime APIGatewayStaticHTTP.ServeFrontend",
          "input": "unmatched frontend path",
          "output": "static file under frontend/ when present",
          "path": "/*filepath",
          "type": "http"
        }
      ]
    },
    {
      "name": "APIGatewayAPI",
      "type": "http",
      "methods": [
        {
          "name": "POST /api/v1/route",
          "name_key": "HTTP POST /api/v1/route",
          "input": "RouteParam JSON",
          "output": "created route, deployed ingress, and new version record",
          "path": "/api/v1/route",
          "type": "http"
        },
        {
          "name": "GET /api/v1/routes",
          "name_key": "HTTP GET /api/v1/routes",
          "input": "none",
          "output": "active route list",
          "path": "/api/v1/routes",
          "type": "http"
        },
        {
          "name": "GET /api/v1/route/:routeID",
          "name_key": "HTTP GET /api/v1/route/:routeID",
          "input": "routeID path param",
          "output": "single route record",
          "path": "/api/v1/route/:routeID",
          "type": "http"
        },
        {
          "name": "POST /api/v1/route/:routeID",
          "name_key": "HTTP POST /api/v1/route/:routeID",
          "input": "routeID path param + RouteParam JSON",
          "output": "updated route, redeployed ingress, and new version record",
          "path": "/api/v1/route/:routeID",
          "type": "http"
        },
        {
          "name": "DELETE /api/v1/route/:routeID",
          "name_key": "HTTP DELETE /api/v1/route/:routeID",
          "input": "routeID path param",
          "output": "soft-deleted route record",
          "path": "/api/v1/route/:routeID",
          "type": "http"
        },
        {
          "name": "GET /api/v1/namespaces",
          "name_key": "HTTP GET /api/v1/namespaces",
          "input": "none",
          "output": "namespace names from informer cache",
          "path": "/api/v1/namespaces",
          "type": "http"
        },
        {
          "name": "GET /api/v1/namespace/:namespace/services",
          "name_key": "HTTP GET /api/v1/namespace/:namespace/services",
          "input": "namespace path param",
          "output": "service names from informer cache",
          "path": "/api/v1/namespace/:namespace/services",
          "type": "http"
        },
        {
          "name": "GET /api/v1/namespace/:namespace/service/:service/ports",
          "name_key": "HTTP GET /api/v1/namespace/:namespace/service/:service/ports",
          "input": "namespace + service path params",
          "output": "service port list from informer cache",
          "path": "/api/v1/namespace/:namespace/service/:service/ports",
          "type": "http"
        },
        {
          "name": "GET /api/v1/versions",
          "name_key": "HTTP GET /api/v1/versions",
          "input": "none",
          "output": "version history rows",
          "path": "/api/v1/versions",
          "type": "http"
        }
      ]
    }
  ]
}
