{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/knoxcall/json-schema/knoxcall-db-role-schema.json",
  "title": "DbRole",
  "description": "A role — the SQL templates KnoxCall runs to create and drop a leased database user.",
  "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/DbRole",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string"
    },
    "creation_sql_template": {
      "type": "string",
      "description": "SQL run to create the leased user."
    },
    "revocation_sql_template": {
      "type": "string",
      "description": "SQL run to drop the leased user."
    },
    "default_ttl_seconds": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Role-level default lease TTL. Null falls back to the connection default."
    },
    "max_ttl_seconds": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Role-level TTL cap. Null falls back to the connection cap."
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}