{
  "repo": "tidbcloud/dataservices",
  "binary": "dataapi_gateway",
  "binary_path": "cmd/dataapi_gateway/main.go",
  "surface_kind": "mixed_service",
  "type": "mixed_service",
  "extensions": {
    "notes": [
      "The public /api/v1beta/app/:external_app_id/endpoint/*path surface exists only outside AliCloud regional mode; AliCloud keeps only the inner routes and rejects NoRoute with 404.",
      "innerBasicAuthGuard is conditional: it only enforces Basic auth when region mode is enabled and provider is not AWS.",
      "HandleCustomDomainQuery is a NoRoute fallback in non-AliCloud mode rather than a first-class registered path; its dependency conditions should be captured in service-mapping, not as a static interface path."
    ]
  },
  "services": [
    {
      "name": "DataAPIGatewayLifecycle",
      "package": "cmd/dataapi_gateway",
      "methods": [
        {
          "name": "LoadConfigAndLogger",
          "name_key": "DataAPIGatewayLifecycle.LoadConfigAndLogger",
          "input": "config-path and sentry config",
          "output": "global config initialized and logger/sentry configured",
          "type": "local"
        },
        {
          "name": "RegisterMetricsAndRBACConfig",
          "name_key": "DataAPIGatewayLifecycle.RegisterMetricsAndRBACConfig",
          "input": "global config, AWS config, and RBAC config",
          "output": "gateway metrics and RBAC path config initialized",
          "type": "local"
        },
        {
          "name": "InitRegionalCaches",
          "name_key": "DataAPIGatewayLifecycle.InitRegionalCaches",
          "input": "regional mode, Redis config, session cache config, and DynamoDB config",
          "output": "Redis, session cache, and DynamoDB initialized when AliCloud regional mode is disabled",
          "type": "local"
        },
        {
          "name": "InitCustomLogger",
          "name_key": "DataAPIGatewayLifecycle.InitCustomLogger",
          "input": "custom log writer config",
          "output": "custom execution logger initialized when config is valid",
          "type": "local"
        },
        {
          "name": "StartUnauthMetricsLoop",
          "name_key": "DataAPIGatewayLifecycle.StartUnauthMetricsLoop",
          "input": "regional mode",
          "output": "background unauth metrics collector started when AliCloud regional mode is disabled",
          "type": "background_worker"
        },
        {
          "name": "RegisterKubeResolver",
          "name_key": "DataAPIGatewayLifecycle.RegisterKubeResolver",
          "input": "in-cluster Kubernetes DNS resolver",
          "output": "kuberesolver registered for gRPC service discovery",
          "type": "local"
        },
        {
          "name": "StartTracing",
          "name_key": "DataAPIGatewayLifecycle.StartTracing",
          "input": "component name dataservices-dataapi-gateway",
          "output": "Jaeger tracer provider initialized",
          "type": "background_worker"
        },
        {
          "name": "StartMetricsServer",
          "name_key": "DataAPIGatewayLifecycle.StartMetricsServer",
          "input": "metrics port from config",
          "output": "HTTP metrics listener exposing /metrics and /custom-metrics",
          "type": "background_worker"
        },
        {
          "name": "RegisterHTTPRoutes",
          "name_key": "DataAPIGatewayLifecycle.RegisterHTTPRoutes",
          "input": "gin.Engine",
          "output": "healthz, public endpoint proxy routes, and inner dataservice routes registered according to cloud mode",
          "type": "local"
        },
        {
          "name": "RegisterGrpcServices",
          "name_key": "DataAPIGatewayLifecycle.RegisterGrpcServices",
          "input": "grpc.Server",
          "output": "DataAPIGatewayService registered after executor client initialization",
          "type": "local"
        },
        {
          "name": "StartHTTPAndGRPCServers",
          "name_key": "DataAPIGatewayLifecycle.StartHTTPAndGRPCServers",
          "input": "HTTP and gRPC listen ports from config",
          "output": "HTTP gateway listener and gRPC listener started in parallel",
          "type": "local"
        }
      ]
    },
    {
      "name": "DataAPIGatewayHTTP",
      "package": "api + internal/controller/dataapi_gateway",
      "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 /api/v1beta/app/:external_app_id/endpoint/*path",
          "name_key": "HTTP GET /api/v1beta/app/:external_app_id/endpoint/*path",
          "path": "/api/v1beta/app/:external_app_id/endpoint/*path",
          "http_method": "GET",
          "input": "public endpoint request in non-AliCloud mode",
          "output": "Advanced endpoint proxy response",
          "type": "http"
        },
        {
          "name": "POST /api/v1beta/app/:external_app_id/endpoint/*path",
          "name_key": "HTTP POST /api/v1beta/app/:external_app_id/endpoint/*path",
          "path": "/api/v1beta/app/:external_app_id/endpoint/*path",
          "http_method": "POST",
          "input": "public endpoint request in non-AliCloud mode",
          "output": "Advanced endpoint proxy response",
          "type": "http"
        },
        {
          "name": "PUT /api/v1beta/app/:external_app_id/endpoint/*path",
          "name_key": "HTTP PUT /api/v1beta/app/:external_app_id/endpoint/*path",
          "path": "/api/v1beta/app/:external_app_id/endpoint/*path",
          "http_method": "PUT",
          "input": "public endpoint request in non-AliCloud mode",
          "output": "Advanced endpoint proxy response",
          "type": "http"
        },
        {
          "name": "DELETE /api/v1beta/app/:external_app_id/endpoint/*path",
          "name_key": "HTTP DELETE /api/v1beta/app/:external_app_id/endpoint/*path",
          "path": "/api/v1beta/app/:external_app_id/endpoint/*path",
          "http_method": "DELETE",
          "input": "public endpoint request in non-AliCloud mode",
          "output": "Advanced endpoint proxy response",
          "type": "http"
        },
        {
          "name": "PATCH /api/v1beta/app/:external_app_id/endpoint/*path",
          "name_key": "HTTP PATCH /api/v1beta/app/:external_app_id/endpoint/*path",
          "path": "/api/v1beta/app/:external_app_id/endpoint/*path",
          "http_method": "PATCH",
          "input": "public endpoint request in non-AliCloud mode",
          "output": "HTTP 404 from noRouter",
          "type": "http"
        },
        {
          "name": "HEAD /api/v1beta/app/:external_app_id/endpoint/*path",
          "name_key": "HTTP HEAD /api/v1beta/app/:external_app_id/endpoint/*path",
          "path": "/api/v1beta/app/:external_app_id/endpoint/*path",
          "http_method": "HEAD",
          "input": "public endpoint request in non-AliCloud mode",
          "output": "HTTP 404 from noRouter",
          "type": "http"
        },
        {
          "name": "OPTIONS /api/v1beta/app/:external_app_id/endpoint/*path",
          "name_key": "HTTP OPTIONS /api/v1beta/app/:external_app_id/endpoint/*path",
          "path": "/api/v1beta/app/:external_app_id/endpoint/*path",
          "http_method": "OPTIONS",
          "input": "public endpoint request in non-AliCloud mode",
          "output": "HTTP 404 from noRouter",
          "type": "http"
        },
        {
          "name": "POST /inner/dataservice/v2/endpoint/test",
          "name_key": "HTTP POST /inner/dataservice/v2/endpoint/test",
          "path": "/inner/dataservice/v2/endpoint/test",
          "http_method": "POST",
          "input": "inner JSON request guarded by host check and optional basic auth in non-AliCloud mode",
          "output": "test-endpoint execution response",
          "type": "http"
        },
        {
          "name": "POST /inner/dataservice/v2/exec/sqltemplate",
          "name_key": "HTTP POST /inner/dataservice/v2/exec/sqltemplate",
          "path": "/inner/dataservice/v2/exec/sqltemplate",
          "http_method": "POST",
          "input": "inner JSON request guarded by host check and optional basic auth",
          "output": "SQL-template execution response",
          "type": "http"
        },
        {
          "name": "POST /inner/dataservice/exec/sql",
          "name_key": "HTTP POST /inner/dataservice/exec/sql",
          "path": "/inner/dataservice/exec/sql",
          "http_method": "POST",
          "input": "inner JSON request guarded by host check and optional basic auth",
          "output": "SQL execution response",
          "type": "http"
        },
        {
          "name": "POST /inner/dataservice/app_id_cluster_permission_check",
          "name_key": "HTTP POST /inner/dataservice/app_id_cluster_permission_check",
          "path": "/inner/dataservice/app_id_cluster_permission_check",
          "http_method": "POST",
          "input": "inner JSON request in non-AliCloud mode",
          "output": "cluster-permission check result",
          "type": "http"
        },
        {
          "name": "POST /inner/dataservice/database/meta",
          "name_key": "HTTP POST /inner/dataservice/database/meta",
          "path": "/inner/dataservice/database/meta",
          "http_method": "POST",
          "input": "inner JSON request guarded by host check and optional basic auth",
          "output": "database metadata response",
          "type": "http"
        },
        {
          "name": "POST /inner/dataservice/session/create",
          "name_key": "HTTP POST /inner/dataservice/session/create",
          "path": "/inner/dataservice/session/create",
          "http_method": "POST",
          "input": "inner JSON request guarded by host check and optional basic auth",
          "output": "session creation response",
          "type": "http"
        },
        {
          "name": "POST /inner/dataservice/session/close",
          "name_key": "HTTP POST /inner/dataservice/session/close",
          "path": "/inner/dataservice/session/close",
          "http_method": "POST",
          "input": "inner JSON request guarded by host check and optional basic auth",
          "output": "session close response",
          "type": "http"
        },
        {
          "name": "POST /inner/dataservice/parse/stmt",
          "name_key": "HTTP POST /inner/dataservice/parse/stmt",
          "path": "/inner/dataservice/parse/stmt",
          "http_method": "POST",
          "input": "inner JSON request guarded by host check and optional basic auth",
          "output": "SQL parse response",
          "type": "http"
        },
        {
          "name": "POST /inner/dataservice/v2/resolvehost",
          "name_key": "HTTP POST /inner/dataservice/v2/resolvehost",
          "path": "/inner/dataservice/v2/resolvehost",
          "http_method": "POST",
          "input": "inner JSON request in non-AliCloud mode",
          "output": "resolved host IP response",
          "type": "http"
        },
        {
          "name": "GET /metrics",
          "name_key": "HTTP GET /metrics",
          "path": "/metrics",
          "http_method": "GET",
          "input": "none",
          "output": "Prometheus metrics",
          "type": "http"
        },
        {
          "name": "GET /custom-metrics",
          "name_key": "HTTP GET /custom-metrics",
          "path": "/custom-metrics",
          "http_method": "GET",
          "input": "none",
          "output": "custom metrics exporter output",
          "type": "http"
        }
      ]
    },
    {
      "name": "DataAPIGatewayService",
      "package": "internal/controller/dataapi_gateway",
      "type": "grpc",
      "methods": [
        {
          "name": "TestEndpointV2",
          "name_key": "DataAPIGatewayService.TestEndpointV2",
          "input": "TestEndpointReqV2",
          "output": "ExecSqlRespV2",
          "type": "grpc"
        },
        {
          "name": "ExecSqlTemplateV2",
          "name_key": "DataAPIGatewayService.ExecSqlTemplateV2",
          "input": "ExecSqlTemplateReqV2",
          "output": "ExecSqlRespV2",
          "type": "grpc"
        },
        {
          "name": "ExecSql",
          "name_key": "DataAPIGatewayService.ExecSql",
          "input": "BasicEndpointReqV2",
          "output": "ExecSqlRespV2",
          "type": "grpc"
        },
        {
          "name": "GetDatabaseMeta",
          "name_key": "DataAPIGatewayService.GetDatabaseMeta",
          "input": "GetDatabaseMetaReq",
          "output": "GetDatabaseMetaResp",
          "type": "grpc"
        },
        {
          "name": "CreateSession",
          "name_key": "DataAPIGatewayService.CreateSession",
          "input": "CreateSessionReq",
          "output": "CreateSessionResp",
          "type": "grpc"
        },
        {
          "name": "CloseSession",
          "name_key": "DataAPIGatewayService.CloseSession",
          "input": "CloseSessionReq",
          "output": "CloseSessionResp",
          "type": "grpc"
        },
        {
          "name": "ParseOneStmt",
          "name_key": "DataAPIGatewayService.ParseOneStmt",
          "input": "ParseOneStmtReq",
          "output": "ParseOneStmtResp",
          "type": "grpc"
        }
      ]
    }
  ]
}
