{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/instaclustr/json-schema/instaclustr-kafka-user-v4-schema.json",
  "title": "KafkaUserV4",
  "description": "Definition of a Kafka User to be applied to a Kafka cluster.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/instaclustr-apache-kafka-user-api-openapi.yml#/components/schemas/KafkaUserV4",
  "required": [
    "authMechanism",
    "clusterId",
    "username"
  ],
  "type": "object",
  "properties": {
    "password": {
      "type": "string",
      "description": "Password for the Kafka user.",
      "format": "password",
      "x-terraform-sensitive": true,
      "x-terraform-write-only": true
    },
    "overrideExistingUser": {
      "type": "boolean",
      "description": "Overwrite user if already exists.",
      "x-terraform-force-new": true,
      "x-terraform-write-only": true
    },
    "saslScramMechanism": {
      "$ref": "#/$defs/KafkaSaslScramMechanism"
    },
    "authMechanism": {
      "$ref": "#/$defs/KafkaAuthMechanismsEnumV2"
    },
    "clusterId": {
      "type": "string",
      "description": "ID of the Kafka cluster.",
      "format": "uuid",
      "x-terraform-force-new": true
    },
    "id": {
      "type": "string",
      "description": "Instaclustr identifier for the Kafka user. The value of this property has the form: [cluster-id]_[kafka-username]",
      "readOnly": true
    },
    "username": {
      "pattern": "^(?![zZ][oO][oO][kK][eE][eE][pP][eE][rR]$)[a-zA-Z0-9][a-zA-Z0-9_-]*$",
      "type": "string",
      "description": "Username of the Kafka user.",
      "x-terraform-force-new": true
    }
  },
  "$defs": {
    "KafkaAuthMechanismsEnumV2": {
      "type": "string",
      "description": "Authentication mechanisms supported for KafkaClusters.",
      "enum": [
        "MTLS",
        "SASL"
      ],
      "x-insta-comment": "Null value included for backwards compatibility"
    },
    "KafkaSaslScramMechanism": {
      "type": "string",
      "description": "Scram Mechanism for SASL authentication. Valid values: SCRAM-SHA-256, SCRAM-SHA-512"
    }
  }
}