{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/knoxcall/json-schema/knoxcall-db-connection-schema.json",
  "title": "DbConnection",
  "description": "A registered database connection. Admin passwords and SSH private keys are never returned.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/knoxcall-dynamic-db-credentials-api-openapi.yml#/components/schemas/DbConnection",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string"
    },
    "engine": {
      "type": "string",
      "enum": [
        "postgres",
        "mysql",
        "mongo"
      ]
    },
    "host": {
      "type": "string"
    },
    "port": {
      "type": [
        "integer",
        "null"
      ]
    },
    "database_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "admin_username": {
      "type": "string",
      "description": "The admin account KnoxCall uses to mint leased users. Its password is encrypted at rest and never returned."
    },
    "execution_mode": {
      "type": "string",
      "enum": [
        "direct",
        "agent_tunnel",
        "ssh_tunnel",
        "iam"
      ]
    },
    "agent_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "The registered agent used for `agent_tunnel` connections."
    },
    "default_ttl_seconds": {
      "type": "integer"
    },
    "max_ttl_seconds": {
      "type": "integer"
    },
    "connect_options": {
      "type": "object",
      "additionalProperties": true,
      "description": "Engine-specific connection options."
    },
    "enabled": {
      "type": "boolean"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "ssh_host": {
      "type": [
        "string",
        "null"
      ],
      "description": "SSH bastion host (`ssh_tunnel` mode)."
    },
    "ssh_port": {
      "type": [
        "integer",
        "null"
      ]
    },
    "ssh_username": {
      "type": [
        "string",
        "null"
      ]
    },
    "iam_region": {
      "type": [
        "string",
        "null"
      ],
      "description": "AWS region (`iam` mode)."
    },
    "iam_db_user": {
      "type": [
        "string",
        "null"
      ],
      "description": "RDS IAM database user (`iam` mode)."
    }
  }
}