{
  "repo": "tidbcloud/ecosystem-service",
  "binary": "server",
  "binary_path": "cmd/server/main.go",
  "dependencies": {
    "HTTP POST /ecosystem/api/v1/orgs/:org_id/projects/:project_id/clusters/:cluster_id/vercel/connections": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SELECT",
              "trigger": "Check if connection exists",
              "conditions": ["Always"],
              "implementation": "c.clusterConnectionDAO.GetVercelConnectionByClusterID"
            },
            {
              "operation": "SELECT",
              "trigger": "Check Vercel integration configuration",
              "conditions": ["Always"],
              "implementation": "c.configurationDAO.GetIntegrationConfigurationByID"
            },
            {
              "operation": "INSERT",
              "trigger": "Create new cluster connection",
              "conditions": ["Valid connection data"],
              "implementation": "c.clusterConnectionDAO.AddVercelConnection"
            }
          ]
        }
      },
      "services": [
        {
          "name": "account",
          "target_interface": "AccountAPIService.GetAuthUser",
          "operation_type": "grpc_unary",
          "target_repo": "tidbcloud/account",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "gRPC GetAuthUser",
              "trigger": "Get authenticated user info",
              "conditions": ["Always"],
              "implementation": "c.accountSvc.GetAuthUser(ctx, email, 0, true)"
            }
          ]
        },
        {
          "name": "mgmt",
          "target_interface": "ClusterService.GetCluster",
          "operation_type": "grpc_unary",
          "target_repo": "tidbcloud/tidb-management-service",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "gRPC GetCluster",
              "trigger": "Validate TiDB cluster exists",
              "conditions": ["Always"],
              "implementation": "c.mgmtSvc.GetCluster(ctx, clusterId, CLUSTER_VIEW_BASIC)"
            }
          ]
        },
        {
          "name": "acl",
          "target_interface": "AccessService.GetJwtByUser",
          "operation_type": "grpc_unary",
          "target_repo": "tidbcloud/account",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "gRPC GetJwtByUser",
              "trigger": "Get JWT for database access",
              "conditions": ["Always"],
              "implementation": "c.aclSvc.GetJwtByUser(ctx, clusterId, userId, email)"
            }
          ]
        },
        {
          "name": "vercel-api",
          "target_interface": "POST /v1/integration/configurations/{id}/projects/{projectId}/env",
          "operation_type": "http_post",
          "target_repo": "vercel/platform",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "HTTP POST",
              "trigger": "Create Vercel environment variables",
              "conditions": ["Always"],
              "implementation": "c.vercelAPIClient.CreateEnvironmentVariables"
            }
          ]
        }
      ]
    },
    "HTTP DELETE /ecosystem/api/v1/orgs/:org_id/projects/:project_id/clusters/:cluster_id/vercel/connections": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SELECT",
              "trigger": "Get connection to delete",
              "conditions": ["Always"],
              "implementation": "c.clusterConnectionDAO.GetVercelConnectionByClusterID"
            },
            {
              "operation": "DELETE",
              "trigger": "Delete cluster connection",
              "conditions": ["Connection exists"],
              "implementation": "c.composeEntityDAO.DeleteClusterConnection"
            }
          ]
        }
      },
      "services": [
        {
          "name": "vercel-api",
          "target_interface": "DELETE /v1/projects/{projectId}/env",
          "operation_type": "http_delete",
          "target_repo": "vercel/platform",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "HTTP DELETE",
              "trigger": "Delete Vercel environment variables",
              "conditions": ["Always"],
              "implementation": "c.vercelAPIClient.DeleteEnvironmentVariables"
            }
          ]
        }
      ]
    },
    "HTTP GET /ecosystem/api/v1/orgs/:org_id/projects/:project_id/clusters/:cluster_id/vercel/connections": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SELECT",
              "trigger": "List cluster connections",
              "conditions": ["Always"],
              "implementation": "c.clusterConnectionDAO.ListVercelConnectionsByClusterID"
            }
          ]
        }
      },
      "services": []
    },
    "HTTP GET /ecosystem/api/v1/vercel/integration/configurations/:configuration_id/connections": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SELECT",
              "trigger": "List cluster connections by project IDs and configuration ID",
              "conditions": ["Always"],
              "implementation": "c.clusterConnectionDAO.ListVercelConnectionsByProjectIDsAndConfigurationID"
            },
            {
              "operation": "SELECT",
              "trigger": "List data app connections by project IDs and configuration ID",
              "conditions": ["Always"],
              "implementation": "c.dataAppConnectionDAO.ListVercelConnectionsByProjectIDsAndConfigurationID"
            }
          ]
        }
      },
      "services": [
        {
          "name": "account",
          "target_interface": "AccountAPIService.GetAuthUser",
          "operation_type": "grpc_unary",
          "target_repo": "tidbcloud/account",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "gRPC GetAuthUser",
              "trigger": "Get authenticated user and accessible projects",
              "conditions": ["Always"],
              "implementation": "c.accountSvc.GetAuthUser(ctx, email, 0, true)"
            }
          ]
        }
      ]
    },
    "HTTP GET /ecosystem/api/v1/vercel/integration/configurations/:configuration_id/projects": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SELECT",
              "trigger": "Get integration configuration",
              "conditions": ["Always"],
              "implementation": "c.configurationDAO.GetIntegrationConfigurationByID"
            }
          ]
        }
      },
      "services": [
        {
          "name": "vercel-api",
          "target_interface": "GET /v1/integration-configurations/{id}",
          "operation_type": "http_get",
          "target_repo": "vercel/platform",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "HTTP GET",
              "trigger": "Retrieve integration configuration from Vercel",
              "conditions": ["Always"],
              "implementation": "c.vercelAPIClient.RetrieveIntegrationConfiguration"
            }
          ]
        },
        {
          "name": "vercel-api",
          "target_interface": "GET /v1/projects",
          "operation_type": "http_get",
          "target_repo": "vercel/platform",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "HTTP GET",
              "trigger": "List Vercel projects",
              "conditions": ["Always"],
              "implementation": "c.vercelAPIClient.RetrieveAllProjects"
            }
          ]
        }
      ]
    },
    "HTTP GET /ecosystem/api/v1/orgs/:org_id/vercel/connections": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SELECT",
              "trigger": "List cluster connections by org ID",
              "conditions": ["Always"],
              "implementation": "c.clusterConnectionDAO.ListVercelConnectionsByOrgID"
            },
            {
              "operation": "SELECT",
              "trigger": "List data app connections by org ID",
              "conditions": ["Always"],
              "implementation": "c.dataAppConnectionDAO.ListVercelConnectionsByOrgID"
            }
          ]
        }
      },
      "services": []
    },
    "HTTP POST /ecosystem/api/v1/vercel/access_token": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "INSERT",
              "trigger": "Save Vercel integration configuration",
              "conditions": ["Valid access token"],
              "implementation": "c.configurationDAO.AddVercelIntegrationConfiguration"
            }
          ]
        }
      },
      "services": [
        {
          "name": "vercel-api",
          "target_interface": "POST /v2/oauth/access_token",
          "operation_type": "http_post",
          "target_repo": "vercel/platform",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "HTTP POST",
              "trigger": "Exchange code for access token",
              "conditions": ["Always"],
              "implementation": "c.vercelAPIClient.ExchangeAccessToken"
            }
          ]
        }
      ]
    },
    "HTTP POST /ecosystem/api/v1/orgs/:org_id/projects/:project_id/serverless/clusters": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SELECT",
              "trigger": "Get Vercel integration configuration",
              "conditions": ["Always"],
              "implementation": "c.configurationDAO.GetIntegrationConfigurationByID"
            },
            {
              "operation": "INSERT",
              "trigger": "Create cluster connection after cluster creation",
              "conditions": ["Cluster created successfully"],
              "implementation": "c.clusterConnectionDAO.AddVercelConnection"
            }
          ]
        }
      },
      "services": [
        {
          "name": "mgmt",
          "target_interface": "ClusterService.CreateServerlessCluster",
          "operation_type": "grpc_unary",
          "target_repo": "tidbcloud/tidb-management-service",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "gRPC CreateServerlessCluster",
              "trigger": "Create TiDB Serverless cluster",
              "conditions": ["Always"],
              "implementation": "c.mgmtSvc.CreateServerlessCluster(ctx, orgID, projectID, email, name, provider, region)"
            }
          ]
        },
        {
          "name": "mgmt",
          "target_interface": "SqlUserService.CreateSqlUser",
          "operation_type": "grpc_unary",
          "target_repo": "tidbcloud/tidb-management-service",
          "conditions": ["Cluster created"],
          "operations": [
            {
              "operation": "gRPC CreateSqlUser",
              "trigger": "Create SQL user for the cluster",
              "conditions": ["Cluster created successfully"],
              "implementation": "c.mgmtSvc.CreateSqlUser(ctx, clusterId, operatorUser, operatorCredential, username, password)"
            }
          ]
        }
      ]
    },
    "HTTP DELETE /ecosystem/api/v1/orgs/:org_id/projects/:project_id/dataapps/:data_app_id/vercel/connections": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SELECT",
              "trigger": "Get data app connection to delete",
              "conditions": ["Always"],
              "implementation": "c.dataAppConnectionDAO.ListVercelConnectionsByDataAppIDs"
            },
            {
              "operation": "DELETE",
              "trigger": "Delete data app connection",
              "conditions": ["Connection exists"],
              "implementation": "c.composeEntityDAO.DeleteDataAppConnection"
            }
          ]
        }
      },
      "services": [
        {
          "name": "vercel-api",
          "target_interface": "DELETE /v1/projects/{projectId}/env",
          "operation_type": "http_delete",
          "target_repo": "vercel/platform",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "HTTP DELETE",
              "trigger": "Delete Vercel environment variables",
              "conditions": ["Always"],
              "implementation": "c.vercelAPIClient.DeleteEnvironmentVariables"
            }
          ]
        }
      ]
    },
    "HTTP POST /ecosystem/api/v1/orgs/:org_id/projects/:project_id/dataapps/:data_app_id/vercel/connections": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SELECT",
              "trigger": "Check if data app connection exists",
              "conditions": ["Always"],
              "implementation": "c.dataAppConnectionDAO.ListVercelConnectionsByDataAppIDs"
            },
            {
              "operation": "INSERT",
              "trigger": "Create data app connection",
              "conditions": ["Valid connection data"],
              "implementation": "c.dataAppConnectionDAO.AddVercelConnection"
            }
          ]
        }
      },
      "services": [
        {
          "name": "dataapi",
          "target_interface": "DataAPIService.ShowDataApp",
          "operation_type": "grpc_unary",
          "target_repo": "tidbcloud/dataservices",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "gRPC ShowDataApp",
              "trigger": "Validate Data App exists",
              "conditions": ["Always"],
              "implementation": "c.dataApiSvc.ShowDataApp(ctx, appID)"
            }
          ]
        },
        {
          "name": "dataapi",
          "target_interface": "DataAPIService.CreateAPIKey",
          "operation_type": "grpc_unary",
          "target_repo": "tidbcloud/dataservices",
          "conditions": ["Create new API key"],
          "operations": [
            {
              "operation": "gRPC CreateAPIKey",
              "trigger": "Create API key for Data App",
              "conditions": ["No existing API key"],
              "implementation": "c.dataApiSvc.CreateApiKey(ctx, appID, userEmail, description)"
            }
          ]
        },
        {
          "name": "vercel-api",
          "target_interface": "POST /v1/integration/configurations/{id}/projects/{projectId}/env",
          "operation_type": "http_post",
          "target_repo": "vercel/platform",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "HTTP POST",
              "trigger": "Create Vercel environment variables",
              "conditions": ["Always"],
              "implementation": "c.vercelAPIClient.CreateEnvironmentVariables"
            }
          ]
        }
      ]
    },
    "HTTP POST /ecosystem/api/v1/vercel/webhooks": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "DELETE",
              "trigger": "Delete connections when project removed",
              "conditions": ["Event: ProjectRemoved"],
              "implementation": "c.composeEntityDAO.DeleteVercelConnectionsByVercelProjectIDs"
            },
            {
              "operation": "DELETE",
              "trigger": "Delete integration configuration when removed",
              "conditions": ["Event: IntegrationRemoved"],
              "implementation": "c.composeEntityDAO.DeleteIntegrationConfiguration"
            },
            {
              "operation": "SELECT",
              "trigger": "Get cluster connection for branch events",
              "conditions": ["Event: DeploymentCreated/Ready/Canceled/Error"],
              "implementation": "c.clusterConnectionDAO.GetVercelConnectionByVercelProjectID"
            },
            {
              "operation": "INSERT",
              "trigger": "Create branch task for deployment",
              "conditions": ["Event: DeploymentCreated"],
              "implementation": "c.branchLogic.HandleCreated"
            }
          ]
        }
      },
      "services": [
        {
          "name": "branch",
          "target_interface": "BranchService.CreateBranch",
          "operation_type": "grpc_unary",
          "target_repo": "tidbcloud/serverless-service",
          "conditions": ["Event: DeploymentCreated", "Valid cluster connection"],
          "operations": [
            {
              "operation": "gRPC CreateBranch",
              "trigger": "Create branch for Vercel preview deployment",
              "conditions": ["DeploymentCreated event", "Cluster connection exists"],
              "implementation": "c.branchLogic.HandleCreated"
            }
          ]
        },
        {
          "name": "branch",
          "target_interface": "BranchService.GetBranch",
          "operation_type": "grpc_unary",
          "target_repo": "tidbcloud/serverless-service",
          "conditions": ["Event: DeploymentReady/Canceled/Error"],
          "operations": [
            {
              "operation": "gRPC GetBranch",
              "trigger": "Get branch status",
              "conditions": ["DeploymentReady/Canceled/Error event"],
              "implementation": "c.branchLogic.HandleReady/HandleCanceled/HandleError"
            }
          ]
        },
        {
          "name": "vercel-api",
          "target_interface": "POST /v1/deployments/{id}/checks",
          "operation_type": "http_post",
          "target_repo": "vercel/platform",
          "conditions": ["Event: DeploymentCreated"],
          "operations": [
            {
              "operation": "HTTP POST",
              "trigger": "Create deployment check on Vercel",
              "conditions": ["DeploymentCreated event"],
              "implementation": "c.vercelAPIClient.CreateCheck"
            }
          ]
        },
        {
          "name": "vercel-api",
          "target_interface": "PATCH /v1/deployments/{id}/checks/{checkId}",
          "operation_type": "http_patch",
          "target_repo": "vercel/platform",
          "conditions": ["Branch ready or failed"],
          "operations": [
            {
              "operation": "HTTP PATCH",
              "trigger": "Update deployment check status",
              "conditions": ["Branch status changed"],
              "implementation": "c.vercelAPIClient.UpdateCheck"
            }
          ]
        }
      ]
    },
    "HTTP GET /ecosystem/api/v1/connect/info": {
      "infrastructure": {},
      "services": []
    },
    "HTTP GET /ecosystem/api/internal/connect/info": {
      "infrastructure": {},
      "services": []
    },
    "HTTP POST /ecosystem/api/internal/pingchat/chat": {
      "infrastructure": {},
      "services": [
        {
          "name": "pingchat-api",
          "target_interface": "POST /chat",
          "operation_type": "http_post",
          "target_repo": "pingcap/chat-api",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "HTTP POST",
              "trigger": "Chat with PingChat AI",
              "conditions": ["Always"],
              "implementation": "client.R().SetBody(chatInfo.Messages).Post('https://chat-api.pingcap.net/chat')"
            }
          ]
        }
      ]
    },
    "HTTP POST /ecosystem/api/v1/integration/github/webhooks": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SELECT",
              "trigger": "Get Git integration by cluster ID",
              "conditions": ["Event: pull_request", "action: opened/synchronize/reopened"],
              "implementation": "c.tiDBGitIntegrationDAO.GetGitIntegrationByClusterID"
            },
            {
              "operation": "INSERT",
              "trigger": "Create GitHub app task for branch status tracking",
              "conditions": ["Branch creation triggered"],
              "implementation": "c.gitHubApp.HandlePullRequest"
            }
          ]
        }
      },
      "services": [
        {
          "name": "branch",
          "target_interface": "BranchService.CreateBranch",
          "operation_type": "grpc_unary",
          "target_repo": "tidbcloud/serverless-service",
          "conditions": ["Event: pull_request", "action: opened/synchronize", "Cluster connected"],
          "operations": [
            {
              "operation": "gRPC CreateBranch",
              "trigger": "Create branch for pull request",
              "conditions": ["Pull request opened/synchronized", "Cluster connected to repo"],
              "implementation": "c.gitHubApp.HandlePullRequest -> branchSvc.CreateBranch"
            }
          ]
        },
        {
          "name": "branch",
          "target_interface": "BranchService.GetBranch",
          "operation_type": "grpc_unary",
          "target_repo": "tidbcloud/serverless-service",
          "conditions": ["Check run re-requested"],
          "operations": [
            {
              "operation": "gRPC GetBranch",
              "trigger": "Get branch status for check run",
              "conditions": ["Check run re-requested"],
              "implementation": "c.gitHubApp.HandleReRequestedCheckRun -> branchSvc.GetBranch"
            }
          ]
        },
        {
          "name": "github-api",
          "target_interface": "POST /repos/{owner}/{repo}/check-runs",
          "operation_type": "http_post",
          "target_repo": "github/api",
          "conditions": ["Branch status changed"],
          "operations": [
            {
              "operation": "HTTP POST",
              "trigger": "Create/update GitHub check run",
              "conditions": ["Branch status changed"],
              "implementation": "c.gitHubApp.UpdateCheckRun"
            }
          ]
        },
        {
          "name": "github-api",
          "target_interface": "POST /repos/{owner}/{repo}/issues/{issue_number}/comments",
          "operation_type": "http_post",
          "target_repo": "github/api",
          "conditions": ["Branch status changed"],
          "operations": [
            {
              "operation": "HTTP POST",
              "trigger": "Create/update GitHub comment",
              "conditions": ["Branch status changed"],
              "implementation": "c.gitHubApp.UpdateComment"
            }
          ]
        }
      ]
    },
    "HTTP POST /ecosystem/api/v1/orgs/:org_id/projects/:project_id/clusters/:cluster_id/git/connections": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SELECT",
              "trigger": "Check if cluster connection exists",
              "conditions": ["Always"],
              "implementation": "c.tiDBGitIntegrationDAO.GetGitIntegrationByClusterID"
            },
            {
              "operation": "SELECT",
              "trigger": "Check if repo already connected",
              "conditions": ["Always"],
              "implementation": "c.tiDBGitIntegrationDAO.GetGitIntegrationByRepo"
            },
            {
              "operation": "INSERT",
              "trigger": "Create Git connection",
              "conditions": ["Valid connection data", "No existing connection"],
              "implementation": "c.tiDBGitIntegrationDAO.AddGitIntegration"
            }
          ]
        }
      },
      "services": [
        {
          "name": "mgmt",
          "target_interface": "ClusterService.GetClusterIncludeDedicated",
          "operation_type": "grpc_unary",
          "target_repo": "tidbcloud/tidb-management-service",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "gRPC GetClusterIncludeDedicated",
              "trigger": "Validate cluster exists and is Serverless",
              "conditions": ["Always"],
              "implementation": "c.mgmtSvc.GetClusterIncludeDedicated(ctx, clusterID, CLUSTER_VIEW_BASIC)"
            }
          ]
        }
      ]
    },
    "HTTP DELETE /ecosystem/api/v1/orgs/:org_id/projects/:project_id/clusters/:cluster_id/git/connections": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "DELETE",
              "trigger": "Delete Git connection by cluster ID",
              "conditions": ["Always"],
              "implementation": "c.tiDBGitIntegrationDAO.DeleteGitIntegrationByClusterID"
            }
          ]
        }
      },
      "services": []
    },
    "HTTP GET /ecosystem/api/v1/orgs/:org_id/projects/:project_id/git/connections": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SELECT",
              "trigger": "List Git connections by project ID",
              "conditions": ["Always"],
              "implementation": "c.tiDBGitIntegrationDAO.ListGitIntegrationByProjectID"
            }
          ]
        }
      },
      "services": [
        {
          "name": "mgmt",
          "target_interface": "ClusterService.GetCluster",
          "operation_type": "grpc_unary",
          "target_repo": "tidbcloud/tidb-management-service",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "gRPC GetCluster",
              "trigger": "Get cluster info for each connection",
              "conditions": ["Always"],
              "implementation": "c.mgmtSvc.GetCluster(ctx, clusterID, CLUSTER_VIEW_BASIC)"
            }
          ]
        }
      ]
    },
    "HTTP GET /ecosystem/api/v1/orgs/:org_id/projects/:project_id/clusters/:cluster_id/git/connections": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SELECT",
              "trigger": "Get Git connection by cluster ID",
              "conditions": ["Always"],
              "implementation": "c.tiDBGitIntegrationDAO.GetGitIntegrationByClusterID"
            }
          ]
        }
      },
      "services": []
    },
    "HTTP GET /ecosystem/api/v1/integration/github/accounts": {
      "infrastructure": {},
      "services": [
        {
          "name": "github-api",
          "target_interface": "GET /user/installations",
          "operation_type": "http_get",
          "target_repo": "github/api",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "HTTP GET",
              "trigger": "Get user GitHub App installations",
              "conditions": ["Always"],
              "implementation": "c.gitHubApp.GetUserInstalledAccounts(ctx, accessToken)"
            }
          ]
        }
      ]
    },
    "HTTP GET /ecosystem/api/v1/integration/github/exchange-token": {
      "infrastructure": {},
      "services": [
        {
          "name": "github-api",
          "target_interface": "POST /login/oauth/access_token",
          "operation_type": "http_post",
          "target_repo": "github/api",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "HTTP POST",
              "trigger": "Exchange OAuth code for access token",
              "conditions": ["Always"],
              "implementation": "c.gitHubApp.GetUserAccessToken(ctx, code)"
            }
          ]
        }
      ]
    },
    "HTTP GET /ecosystem/api/v1/integration/github/search-repo-v2": {
      "infrastructure": {},
      "services": [
        {
          "name": "github-api",
          "target_interface": "GET /user/installations",
          "operation_type": "http_get",
          "target_repo": "github/api",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "HTTP GET",
              "trigger": "Verify installation belongs to user",
              "conditions": ["Always"],
              "implementation": "c.gitHubApp.GetUserInstalledAccounts(ctx, accessToken)"
            }
          ]
        },
        {
          "name": "github-api",
          "target_interface": "GET /user/installations/{installation_id}/repositories",
          "operation_type": "http_get",
          "target_repo": "github/api",
          "conditions": ["Installation verified"],
          "operations": [
            {
              "operation": "HTTP GET",
              "trigger": "List repositories for installation",
              "conditions": ["Installation belongs to user"],
              "implementation": "c.gitHubApp.ListRepositories(ctx, installationID)"
            }
          ]
        }
      ]
    },
    "HTTP GET /metrics": {
      "infrastructure": {},
      "services": []
    },
    "HTTP GET /swagger/vercel/*any": {
      "infrastructure": {},
      "services": []
    },
    "HTTP GET /swagger/git/*any": {
      "infrastructure": {},
      "services": []
    },
    "HTTP GET /swagger/connect/*any": {
      "infrastructure": {},
      "services": []
    },
    "Runtime AutoCleanConnections.Run": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SELECT",
              "trigger": "List all data app IDs",
              "conditions": ["Always"],
              "implementation": "j.dataAppConnectionDAO.ListAllDataAppIDs"
            },
            {
              "operation": "SELECT",
              "trigger": "List connections for deleted data app",
              "conditions": ["Data app not found"],
              "implementation": "j.dataAppConnectionDAO.ListVercelConnectionsByDataAppIDs"
            },
            {
              "operation": "DELETE",
              "trigger": "Delete data app connection",
              "conditions": ["Data app deleted", "Env vars deleted successfully"],
              "implementation": "j.composeEntityDAO.DeleteDataAppConnection"
            }
          ]
        }
      },
      "services": [
        {
          "name": "dataapi",
          "target_interface": "DataAPIService.ShowDataApp",
          "operation_type": "grpc_unary",
          "target_repo": "tidbcloud/dataservices",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "gRPC ShowDataApp",
              "trigger": "Check if data app still exists",
              "conditions": ["Always"],
              "implementation": "j.dataApiSvc.ShowDataApp(ctx, dataAppID)"
            }
          ]
        },
        {
          "name": "vercel-api",
          "target_interface": "DELETE /v1/projects/{projectId}/env",
          "operation_type": "http_delete",
          "target_repo": "vercel/platform",
          "conditions": ["Data app deleted"],
          "operations": [
            {
              "operation": "HTTP DELETE",
              "trigger": "Delete Vercel environment variables for deleted data app",
              "conditions": ["Data app not found"],
              "implementation": "j.dataAppLogic.DeleteEnvsByEnvIdentifier"
            }
          ]
        }
      ]
    },
    "Runtime VercelMetricsJob.Run": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SELECT",
              "trigger": "Count cluster connections",
              "conditions": ["Always"],
              "implementation": "j.db.Table('cluster_connections').Count(&connCount)"
            },
            {
              "operation": "SELECT",
              "trigger": "Count data app connections",
              "conditions": ["Always"],
              "implementation": "j.db.Table('data_app_connections').Count(&connCount)"
            }
          ]
        }
      },
      "services": []
    },
    "Runtime GitAutoClean.Run": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SELECT",
              "trigger": "List all Git integrations",
              "conditions": ["Always"],
              "implementation": "g.tiDBGitIntegrationDAO.ListAllGitIntegrations"
            },
            {
              "operation": "DELETE",
              "trigger": "Delete Git connection for deleted cluster",
              "conditions": ["Cluster deleted"],
              "implementation": "g.tiDBGitIntegrationDAO.DeleteGitIntegrationByClusterID"
            }
          ]
        }
      },
      "services": [
        {
          "name": "mgmt",
          "target_interface": "ClusterService.ListClusters",
          "operation_type": "grpc_unary",
          "target_repo": "tidbcloud/tidb-management-service",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "gRPC ListClusters",
              "trigger": "Check cluster status for all connected clusters",
              "conditions": ["Always"],
              "implementation": "g.mgmtSvc.ListClusters(ctx, clusterIDs, CLUSTER_VIEW_BASIC)"
            }
          ]
        }
      ]
    },
    "Runtime UploadToBigquery.Run": {
      "infrastructure": {
        "mysql": {
          "conditions": ["BigQueryConfig.Enable == true"],
          "operations": [
            {
              "operation": "SELECT",
              "trigger": "List all Vercel connections",
              "conditions": ["BigQuery enabled"],
              "implementation": "j.connectionDAO.ListVercelConnections"
            }
          ]
        },
        "bigquery": {
          "conditions": ["BigQueryConfig.Enable == true"],
          "operations": [
            {
              "operation": "INSERT",
              "trigger": "Upload connections to BigQuery",
              "conditions": ["BigQuery enabled", "Connections found"],
              "implementation": "j.uploader.UploadConnections(ctx, connections)"
            }
          ]
        }
      },
      "services": []
    }
  }
}
