{
  "repo": "tidbcloud/aws-shared-provider",
  "binary": "audit-log",
  "binary_path": "cmd/audit-log/main.go",
  "dependencies": {
    "HTTP GET /healthz": {
      "infrastructure": {},
      "services": []
    },
    "HTTP GET /metrics": {
      "infrastructure": {},
      "services": []
    },
    "Runtime SchedulerCronJobs.Merge": {
      "infrastructure": {
        "s3": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "GET",
              "trigger": "Download audit log files for merging",
              "conditions": ["Always"],
              "implementation": "s3Client.GetObject"
            },
            {
              "operation": "PUT",
              "trigger": "Upload merged audit log file",
              "conditions": ["Always"],
              "implementation": "s3Client.PutObject"
            }
          ]
        },
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SELECT",
              "trigger": "Query audit log schedule tasks",
              "conditions": ["Always"],
              "implementation": "auditLogScheduleRepo.List"
            },
            {
              "operation": "UPDATE",
              "trigger": "Update schedule status",
              "conditions": ["Always"],
              "implementation": "auditLogScheduleRepo.Update"
            }
          ]
        }
      },
      "services": []
    },
    "Runtime SchedulerCronJobs.Dispatch": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SELECT",
              "trigger": "Query pending audit log tasks",
              "conditions": ["Always"],
              "implementation": "auditLogTaskRepo.List"
            },
            {
              "operation": "INSERT",
              "trigger": "Create new audit log tasks",
              "conditions": ["New tasks needed"],
              "implementation": "auditLogTaskRepo.Create"
            }
          ]
        }
      },
      "services": [
        {
          "name": "kubernetes-api",
          "target_interface": "POST /apis/batch/v1/namespaces/{ns}/jobs",
          "operation_type": "http_post",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "Create Job",
              "trigger": "Dispatch audit log worker jobs",
              "conditions": ["Always"],
              "implementation": "k8sClient.Create(ctx, workerJob)"
            }
          ]
        }
      ]
    },
    "Runtime SchedulerCronJobs.Clean": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "DELETE",
              "trigger": "Delete old audit log records",
              "conditions": ["Records older than retention period"],
              "implementation": "auditLogTaskRepo.DeleteOld"
            }
          ]
        },
        "s3": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "DELETE",
              "trigger": "Delete old audit log files",
              "conditions": ["Files older than retention period"],
              "implementation": "s3Client.DeleteObject"
            }
          ]
        }
      },
      "services": []
    },
    "Runtime WorkerJobController.Reconcile": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "UPDATE",
              "trigger": "Update task status when worker fails or completes",
              "conditions": ["Worker job status change"],
              "implementation": "auditLogTaskRepo.BatchFailed"
            }
          ]
        }
      },
      "services": [
        {
          "name": "kubernetes-api",
          "target_interface": "GET /apis/batch/v1/namespaces/{ns}/jobs/{name}",
          "operation_type": "http_get",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "Get worker job status",
              "trigger": "Check worker job status",
              "conditions": ["Always"],
              "implementation": "manager.GetClient().Get"
            }
          ]
        },
        {
          "name": "kubernetes-api",
          "target_interface": "DELETE /apis/batch/v1/namespaces/{ns}/jobs/{name}",
          "operation_type": "http_delete",
          "conditions": ["Job complete"],
          "operations": [
            {
              "operation": "Delete completed worker job",
              "trigger": "Clean up completed job",
              "conditions": ["Job complete"],
              "implementation": "manager.GetClient().Delete"
            }
          ]
        }
      ]
    },
    "CLI worker": {
      "infrastructure": {
        "s3": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "GET",
              "trigger": "Download audit log files from TiDB cluster",
              "conditions": ["Always"],
              "implementation": "s3Client.GetObject"
            },
            {
              "operation": "PUT",
              "trigger": "Upload processed audit log to o11y bucket",
              "conditions": ["Always"],
              "implementation": "o11yS3Client.PutObject"
            }
          ]
        },
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SELECT",
              "trigger": "Get task details",
              "conditions": ["Always"],
              "implementation": "auditLogTaskRepo.Get"
            },
            {
              "operation": "UPDATE",
              "trigger": "Update task status",
              "conditions": ["Always"],
              "implementation": "auditLogTaskRepo.Update"
            }
          ]
        }
      },
      "services": []
    }
  }
}
