{
  "repo": "tidbcloud/dataapps",
  "binary": "sqleditor",
  "binary_path": "cmd/sqleditor/main.go",
  "surface_kind": "mixed_service",
  "type": "mixed_service",
  "services": [
    {
      "name": "SqlEditorLifecycle",
      "package": "main",
      "methods": [
        {
          "name": "LoadConfig",
          "name_key": "Runtime SqlEditorLifecycle.LoadConfig",
          "input": "--config-path",
          "output": "global config loaded into config.Global()",
          "type": "local"
        },
        {
          "name": "SetupObservability",
          "name_key": "Runtime SqlEditorLifecycle.SetupObservability",
          "input": "sentry + log + tracing config",
          "output": "logger, sentry, and jaeger initialized",
          "type": "local"
        },
        {
          "name": "ConnectDatabase",
          "name_key": "Runtime SqlEditorLifecycle.ConnectDatabase",
          "input": "mysql config",
          "output": "shared GORM connection initialized",
          "type": "local"
        },
        {
          "name": "StartEventbus",
          "name_key": "Runtime SqlEditorLifecycle.StartEventbus",
          "input": "gardener.env",
          "output": "user settings event handler registered and eventbus consumer loop started",
          "type": "local"
        },
        {
          "name": "StartAuditLog",
          "name_key": "Runtime SqlEditorLifecycle.StartAuditLog",
          "input": "server.localMode",
          "output": "auditlog SDK initialized when not in local mode",
          "type": "local"
        },
        {
          "name": "RegisterHTTPRoutes",
          "name_key": "Runtime SqlEditorLifecycle.RegisterHTTPRoutes",
          "input": "gin.Engine",
          "output": "public sqleditor, inner, swagger, and EDA routes registered with middleware",
          "type": "local"
        },
        {
          "name": "RegisterGRPCServices",
          "name_key": "Runtime SqlEditorLifecycle.RegisterGRPCServices",
          "input": "*grpc.Server",
          "output": "SqlEditorService registered",
          "type": "local"
        },
        {
          "name": "StartMetricsServer",
          "name_key": "Runtime SqlEditorLifecycle.StartMetricsServer",
          "input": "fixed address 0.0.0.0:9090",
          "output": "metrics listener serving /metrics",
          "type": "local"
        },
        {
          "name": "StartGRPCServer",
          "name_key": "Runtime SqlEditorLifecycle.StartGRPCServer",
          "input": "server.grpcPort",
          "output": "gRPC listener serving SqlEditorService",
          "type": "local"
        },
        {
          "name": "StartHTTPServer",
          "name_key": "Runtime SqlEditorLifecycle.StartHTTPServer",
          "input": "server.httpListenAddr",
          "output": "public HTTP listener serving sqleditor, inner, swagger, and EDA routes",
          "type": "local"
        }
      ]
    },
    {
      "name": "SqlEditorHTTP",
      "package": "api + internal/controller/sqleditor",
      "type": "http",
      "methods": [
        {
          "name": "GET /healthz",
          "name_key": "HTTP GET /healthz",
          "path": "/healthz",
          "http_method": "GET",
          "input": "none",
          "output": "HTTP 200",
          "type": "http"
        },
        {
          "name": "GET /swagger/*any",
          "name_key": "HTTP GET /swagger/*any",
          "path": "/swagger/*any",
          "http_method": "GET",
          "input": "swagger asset path",
          "output": "swagger UI or spec asset",
          "type": "http"
        },
        {
          "name": "PUT /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/settings",
          "name_key": "HTTP PUT /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/settings",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/settings",
          "http_method": "PUT",
          "input": "Settings JSON body",
          "output": "updated settings ack",
          "type": "http"
        },
        {
          "name": "GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/settings",
          "name_key": "HTTP GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/settings",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/settings",
          "http_method": "GET",
          "input": "path params",
          "output": "current SQL editor settings plus dataapp toggle state",
          "type": "http"
        },
        {
          "name": "POST /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/statements",
          "name_key": "HTTP POST /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/statements",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/statements",
          "http_method": "POST",
          "input": "StatementParam JSON body",
          "output": "SQL execution result payload",
          "type": "http"
        },
        {
          "name": "GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/dbs/:db_name/:table_name/meta",
          "name_key": "HTTP GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/dbs/:db_name/:table_name/meta",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/dbs/:db_name/:table_name/meta",
          "http_method": "GET",
          "input": "db_name + table_name path params",
          "output": "column metadata for the target table",
          "type": "http"
        },
        {
          "name": "GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/dbs/:db_name/:table_name/exist",
          "name_key": "HTTP GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/dbs/:db_name/:table_name/exist",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/dbs/:db_name/:table_name/exist",
          "http_method": "GET",
          "input": "db_name + table_name path params",
          "output": "session id plus existence flag",
          "type": "http"
        },
        {
          "name": "POST /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/sqlfiles",
          "name_key": "HTTP POST /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/sqlfiles",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/sqlfiles",
          "http_method": "POST",
          "input": "SQLFileReq JSON body",
          "output": "created SQL file id",
          "type": "http"
        },
        {
          "name": "GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/sqlfiles/:sql_file_id",
          "name_key": "HTTP GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/sqlfiles/:sql_file_id",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/sqlfiles/:sql_file_id",
          "http_method": "GET",
          "input": "sql_file_id path param",
          "output": "stored SQL file payload",
          "type": "http"
        },
        {
          "name": "PUT /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/sqlfiles/:sql_file_id",
          "name_key": "HTTP PUT /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/sqlfiles/:sql_file_id",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/sqlfiles/:sql_file_id",
          "http_method": "PUT",
          "input": "sql_file_id path param + SQLFileReq JSON body",
          "output": "update ack",
          "type": "http"
        },
        {
          "name": "DELETE /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/sqlfiles/:sql_file_id",
          "name_key": "HTTP DELETE /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/sqlfiles/:sql_file_id",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/sqlfiles/:sql_file_id",
          "http_method": "DELETE",
          "input": "sql_file_id path param",
          "output": "delete ack",
          "type": "http"
        },
        {
          "name": "GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/sqlfiles",
          "name_key": "HTTP GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/sqlfiles",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/sqlfiles",
          "http_method": "GET",
          "input": "cluster_id path param",
          "output": "SQL file list",
          "type": "http"
        },
        {
          "name": "POST /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/session",
          "name_key": "HTTP POST /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/session",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/session",
          "http_method": "POST",
          "input": "SessionParam JSON body",
          "output": "created session id",
          "type": "http"
        },
        {
          "name": "DELETE /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/session/:session_id",
          "name_key": "HTTP DELETE /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/session/:session_id",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/session/:session_id",
          "http_method": "DELETE",
          "input": "session_id path param",
          "output": "close-session ack",
          "type": "http"
        },
        {
          "name": "GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/meta",
          "name_key": "HTTP GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/meta",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/meta",
          "http_method": "GET",
          "input": "cluster_id path param + isbrief query",
          "output": "cluster database and table metadata",
          "type": "http"
        },
        {
          "name": "GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/schemas/databases",
          "name_key": "HTTP GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/schemas/databases",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/schemas/databases",
          "http_method": "GET",
          "input": "cluster_id path param",
          "output": "database list",
          "type": "http"
        },
        {
          "name": "GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/schemas/databases/:db_name/tables",
          "name_key": "HTTP GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/schemas/databases/:db_name/tables",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/schemas/databases/:db_name/tables",
          "http_method": "GET",
          "input": "db_name path param",
          "output": "table list",
          "type": "http"
        },
        {
          "name": "GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/schemas/databases/:db_name/tables/:table_name/columns",
          "name_key": "HTTP GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/schemas/databases/:db_name/tables/:table_name/columns",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/schemas/databases/:db_name/tables/:table_name/columns",
          "http_method": "GET",
          "input": "db_name + table_name path params",
          "output": "column list",
          "type": "http"
        },
        {
          "name": "GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/schemas/search",
          "name_key": "HTTP GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/schemas/search",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/schemas/search",
          "http_method": "GET",
          "input": "keyword + type + limit query params",
          "output": "schema search results",
          "type": "http"
        },
        {
          "name": "POST /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/sample/initialize",
          "name_key": "HTTP POST /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/sample/initialize",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/sample/initialize",
          "http_method": "POST",
          "input": "cluster_id path param",
          "output": "fortune500 initialization result",
          "type": "http"
        },
        {
          "name": "GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/status",
          "name_key": "HTTP GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/status",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/status",
          "http_method": "GET",
          "input": "cluster_ids query param",
          "output": "cluster status list",
          "type": "http"
        },
        {
          "name": "GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/users",
          "name_key": "HTTP GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/users",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/users",
          "http_method": "GET",
          "input": "project path params",
          "output": "user info payload",
          "type": "http"
        },
        {
          "name": "PUT /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/users",
          "name_key": "HTTP PUT /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/users",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/users",
          "http_method": "PUT",
          "input": "user-info JSON body",
          "output": "update ack",
          "type": "http"
        },
        {
          "name": "PUT /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/settings",
          "name_key": "HTTP PUT /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/settings",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/settings",
          "http_method": "PUT",
          "input": "DataAppSettingsFormat JSON body",
          "output": "dataapp settings update ack",
          "type": "http"
        },
        {
          "name": "POST /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/oplog",
          "name_key": "HTTP POST /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/oplog",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/oplog",
          "http_method": "POST",
          "input": "SqlEditorOplogParam JSON body",
          "output": "oplog create ack",
          "type": "http"
        },
        {
          "name": "GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/dataapi/sample",
          "name_key": "HTTP GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/dataapi/sample",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/dataapi/sample",
          "http_method": "GET",
          "input": "cluster_id path param",
          "output": "chat2data sample curl/code example",
          "type": "http"
        },
        {
          "name": "POST /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/bot",
          "name_key": "HTTP POST /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/bot",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/bot",
          "http_method": "POST",
          "input": "InteractRequest JSON body",
          "output": "chatbot response payload",
          "type": "http"
        },
        {
          "name": "GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/enter/audit",
          "name_key": "HTTP GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/enter/audit",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/clusters/:cluster_id/enter/audit",
          "http_method": "GET",
          "input": "cluster_id path param",
          "output": "audit-log submit ack",
          "type": "http"
        },
        {
          "name": "GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/permission/entry",
          "name_key": "HTTP GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/permission/entry",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/permission/entry",
          "http_method": "GET",
          "input": "cluster_ids query param",
          "output": "serverless entry permission results",
          "type": "http"
        },
        {
          "name": "GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/streaming",
          "name_key": "HTTP GET /api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/streaming",
          "path": "/api/v1/dataapps/sqleditor/orgs/:org_id/projects/:project_id/streaming",
          "http_method": "GET",
          "input": "QueryStreamResultReq query string",
          "output": "streaming completion status plus parsed result payload",
          "type": "http"
        }
      ]
    },
    {
      "name": "SqlEditorInternalHTTP",
      "package": "internal/controller/sqleditor",
      "type": "http",
      "methods": [
        {
          "name": "POST /inner/sqleditor/oplog",
          "name_key": "HTTP POST /inner/sqleditor/oplog",
          "path": "/inner/sqleditor/oplog",
          "http_method": "POST",
          "input": "InnerSqlEditorOplogParam JSON body",
          "output": "inner oplog create ack",
          "type": "http"
        }
      ]
    },
    {
      "name": "SqlEditorEDAProxyHTTP",
      "package": "internal/controller/eda",
      "type": "http",
      "methods": [
        {
          "name": "ANY /api/v1/eda/orgs/:org_id/projects/:project_id/*path",
          "name_key": "Runtime SqlEditorEDAProxyHTTP.ProxyRequests",
          "path": "/api/v1/eda/orgs/:org_id/projects/:project_id/*path",
          "http_method": "ANY",
          "input": "proxied HTTP request",
          "output": "proxied EDA response",
          "type": "http"
        }
      ]
    },
    {
      "name": "SqlEditorMetricsHTTP",
      "package": "main",
      "type": "http",
      "methods": [
        {
          "name": "GET /metrics",
          "name_key": "HTTP GET /metrics",
          "path": "/metrics",
          "http_method": "GET",
          "input": "Prometheus scrape request",
          "output": "Prometheus metrics payload",
          "type": "http"
        }
      ]
    },
    {
      "name": "SqlEditorGRPC",
      "package": "internal/controller/sqleditor",
      "type": "grpc",
      "methods": [
        {
          "name": "CreateOpLog",
          "name_key": "SqlEditorGRPC.CreateOpLog",
          "input": "CreateOpLogReq",
          "output": "CreateOpLogResp",
          "type": "grpc"
        }
      ]
    }
  ],
  "extensions": {
    "notes": [
      "The public HTTP listener applies global middleware in this order: Metric, InjectLogger, API error reporter, inner route registration, CORS, CheckUser, CheckRBACPermission, CheckRequestBodySize, and CheckDedicatedClusterPermission before the main sqleditor or EDA routes run.",
      "The binary exposes three listeners at runtime: the main HTTP API, a dedicated metrics listener on 0.0.0.0:9090, and a separate gRPC listener on server.grpcPort.",
      "The public router also includes an inner /inner/sqleditor/oplog route and the EDA proxy, so the runtime surface is larger than the old sqleditor-only endpoint list.",
      "Eventbus startup is environment-gated and audit-log SDK startup is local-mode-gated; both are part of the binary lifecycle even though they are not tied to a single HTTP handler."
    ]
  }
}
