{
  "repo": "tidbcloud/debug-portal",
  "binary": "debug-portal",
  "binary_path": "cmd/main.go",
  "surface_kind": "mixed_service",
  "type": "mixed_service",
  "services": [
    {
      "name": "DebugPortalLifecycle",
      "package": "main",
      "methods": [
        {
          "name": "Startup",
          "name_key": "Runtime DebugPortalLifecycle.Startup",
          "input": "config-path",
          "output": "running gRPC server + HTTP gateway",
          "type": "local"
        },
        {
          "name": "BuildGRPCServer",
          "name_key": "Runtime DebugPortalLifecycle.BuildGRPCServer",
          "input": "global config + model + session manager",
          "output": "grpc.Server",
          "type": "local"
        },
        {
          "name": "BuildHTTPGateway",
          "name_key": "Runtime DebugPortalLifecycle.BuildHTTPGateway",
          "input": "localhost:9191",
          "output": "gin.Engine",
          "type": "local"
        }
      ]
    },
    {
      "name": "CentralDebugPortalService",
      "package": "debug_portal",
      "methods": [
        {
          "name": "GetOAuthConfig",
          "name_key": "CentralDebugPortalService.GetOAuthConfig",
          "input": "DebugPortalGetOAuthConfigReq",
          "output": "DebugPortalGetOAuthConfigResp"
        },
        {
          "name": "ExchangeOAuthToken",
          "name_key": "CentralDebugPortalService.ExchangeOAuthToken",
          "input": "DebugPortalExchangeOAuthTokenReq",
          "output": "DebugPortalExchangeOAuthTokenResp"
        },
        {
          "name": "SignOut",
          "name_key": "CentralDebugPortalService.SignOut",
          "input": "DebugPortalSignOutReq",
          "output": "DebugPortalSignOutResp"
        },
        {
          "name": "GetBasicSession",
          "name_key": "CentralDebugPortalService.GetBasicSession",
          "input": "google.protobuf.Empty",
          "output": "DebugPortalGetBasicSessionResp"
        },
        {
          "name": "ListTenants",
          "name_key": "CentralDebugPortalService.ListTenants",
          "input": "ListTenantsReq",
          "output": "ListTenantsResp"
        },
        {
          "name": "GetTenantById",
          "name_key": "CentralDebugPortalService.GetTenantById",
          "input": "OrgIdReq",
          "output": "Tenant"
        },
        {
          "name": "ListTenantClusters",
          "name_key": "CentralDebugPortalService.ListTenantClusters",
          "input": "ListTenantClustersReq",
          "output": "ListTenantClustersResp"
        },
        {
          "name": "GetDashboardLinks",
          "name_key": "CentralDebugPortalService.GetDashboardLinks",
          "input": "GetDashboardLinksReq",
          "output": "GetDashboardLinksResp"
        }
      ]
    },
    {
      "name": "HTTPGateway",
      "type": "http",
      "methods": [
        {
          "name": "GET /debug-api/v1/oauth/config",
          "name_key": "HTTP GET /debug-api/v1/oauth/config",
          "input": "query: redirect_uri",
          "output": "DebugPortalGetOAuthConfigResp",
          "path": "/debug-api/v1/oauth/config",
          "type": "http"
        },
        {
          "name": "POST /debug-api/v1/oauth/exchange",
          "name_key": "HTTP POST /debug-api/v1/oauth/exchange",
          "input": "DebugPortalExchangeOAuthTokenReq",
          "output": "DebugPortalExchangeOAuthTokenResp",
          "path": "/debug-api/v1/oauth/exchange",
          "type": "http"
        },
        {
          "name": "POST /debug-api/v1/auth/sign_out",
          "name_key": "HTTP POST /debug-api/v1/auth/sign_out",
          "input": "DebugPortalSignOutReq",
          "output": "DebugPortalSignOutResp",
          "path": "/debug-api/v1/auth/sign_out",
          "type": "http"
        },
        {
          "name": "GET /debug-api/v1/me",
          "name_key": "HTTP GET /debug-api/v1/me",
          "input": "none",
          "output": "DebugPortalGetBasicSessionResp",
          "path": "/debug-api/v1/me",
          "type": "http"
        },
        {
          "name": "GET /debug-api/v1/orgs",
          "name_key": "HTTP GET /debug-api/v1/orgs",
          "input": "query: name,id,email,status,page,per_page",
          "output": "ListTenantsResp",
          "path": "/debug-api/v1/orgs",
          "type": "http"
        },
        {
          "name": "GET /debug-api/v1/orgs/{org_id}",
          "name_key": "HTTP GET /debug-api/v1/orgs/{org_id}",
          "input": "path: org_id",
          "output": "Tenant",
          "path": "/debug-api/v1/orgs/{org_id}",
          "type": "http"
        },
        {
          "name": "GET /debug-api/v1/orgs/{org_id}/clusters",
          "name_key": "HTTP GET /debug-api/v1/orgs/{org_id}/clusters",
          "input": "path: org_id; query: page,per_page",
          "output": "ListTenantClustersResp",
          "path": "/debug-api/v1/orgs/{org_id}/clusters",
          "type": "http"
        },
        {
          "name": "GET /debug-api/v1/orgs/{org_id}/clusters/{cluster_id}/dashboard_links",
          "name_key": "HTTP GET /debug-api/v1/orgs/{org_id}/clusters/{cluster_id}/dashboard_links",
          "input": "path: org_id,cluster_id",
          "output": "GetDashboardLinksResp",
          "path": "/debug-api/v1/orgs/{org_id}/clusters/{cluster_id}/dashboard_links",
          "type": "http"
        }
      ]
    }
  ],
  "extensions": {
    "notes": [
      "The binary starts a native gRPC server on :9191 and a Gin-hosted grpc-gateway on :8080; the HTTP surface is not a separate business implementation.",
      "Protected business methods authenticate by reading the debug session cookie and, for non-GET requests, validating the x-csrf-token header in session.SessionManager.GrpcGetDebugSessionUser.",
      "Method-level dependencies below are sourced from pkg/auth.go, pkg/tenant_cluster.go, session/oauth.go, model/debug.go, model/grafana.go, grpc/grpcli/core.go, and cmd/main.go."
    ]
  }
}
