{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/cloudera/main/json-schema/cloudera-create-database-request-schema.json",
  "title": "CreateDatabaseRequest",
  "description": "A request to create the database",
  "x-generated": "2026-10-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cloudera-opdb-api-openapi.yml#/components/schemas/CreateDatabaseRequest",
  "type": "object",
  "required": [
    "environmentName",
    "databaseName"
  ],
  "properties": {
    "environmentName": {
      "type": "string",
      "description": "environment name"
    },
    "databaseName": {
      "type": "string",
      "description": "database name"
    },
    "autoScalingParameters": {
      "description": "Parameters to configure the AutoScaling",
      "$ref": "#/$defs/AutoScalingParameters"
    },
    "subnetId": {
      "type": "string",
      "description": "Override subnet where the database will be deployed. Disables Multi-AZ if set [only for AWS]."
    },
    "customUserTags": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/KeyValuePair"
      },
      "description": "Optional tags to apply to launched infrastructure resources"
    },
    "disableMultiAz": {
      "type": "boolean",
      "description": "Disable deployment into multiple availability-zones (the database will be deployed into one subnet)."
    },
    "attachedStorageForWorkers": {
      "description": "Attached storage for the worker nodes for AWS, Azure, and GCP cloud providers.",
      "$ref": "#/$defs/AttachedStorageForWorkers"
    },
    "disableKerberos": {
      "type": "boolean",
      "description": "Disable Kerberos authentication."
    },
    "numEdgeNodes": {
      "type": "integer",
      "format": "int32",
      "description": "Number of edge nodes to be created for the database. A positive, non-zero number is required. The default value is 0."
    },
    "image": {
      "description": "Image details for the database.",
      "$ref": "#/$defs/Image"
    },
    "disableJwtAuth": {
      "type": "boolean",
      "description": "Disable OAuth Bearer (JWT) authentication scheme."
    },
    "enableRegionCanary": {
      "type": "boolean",
      "description": "To enable the region canary for the database."
    },
    "scaleType": {
      "description": "Optional tags to choose one of the predefined cluster sizes.",
      "$ref": "#/$defs/ScaleType"
    },
    "storageType": {
      "description": "Optional tag to choose the storage types.",
      "$ref": "#/$defs/StorageType"
    },
    "recipes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CustomRecipe"
      },
      "description": "Custom recipes for the database."
    },
    "enableGrafana": {
      "type": "boolean",
      "description": "To enable grafana server for the database."
    },
    "rootVolumeSize": {
      "type": "integer",
      "format": "int32",
      "description": "Root volume size in GiB."
    },
    "volumeEncryptions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/VolumeEncryption"
      },
      "description": "Specifies encryption key to encrypt volume for instance group. It is currently supported for AWS cloud provider only."
    },
    "gatewayNodesCount": {
      "type": "integer",
      "format": "int32",
      "description": "Number of gateway nodes to be created for the database. When multiple gateway nodes are present Knox works in HA mode. A positive, non-zero number is required. The default value is 1. Requires the COD_RESTWORKERS entitlement."
    },
    "restworkerNodesCount": {
      "type": "integer",
      "format": "int32",
      "description": "Number of REST Worker nodes to be created for the database. A positive, non-zero number is required. The default value is 0. Requires the COD_RESTWORKERS entitlement."
    },
    "architecture": {
      "description": "Specifies the Architecture of the cluster nodes.",
      "$ref": "#/$defs/ArchitectureType"
    },
    "customInstanceTypes": {
      "description": "Provide custom VM instance types for master, worker, gateway, leader, edge and compute groups.",
      "$ref": "#/$defs/CustomInstanceTypes"
    }
  },
  "$defs": {
    "ArchitectureType": {
      "type": "string",
      "description": "Architecture type for cluster.\n `X86_64` - X64 CPU Architecture is used for the cluster. `ARM64` - ARM64 CPU Architecture is used for the cluster.",
      "enum": [
        "X86_64",
        "ARM64"
      ]
    },
    "AttachedStorageForWorkers": {
      "type": "object",
      "description": "Attached storage for the worker nodes for AWS, Azure, and GCP cloud providers.",
      "properties": {
        "volumeCount": {
          "type": "integer",
          "format": "int32",
          "minimum": 1,
          "maximum": 8,
          "description": "The number of Volumes. Default is 4. Valid Range: Minimum value of 1, maximum value 8."
        },
        "volumeSize": {
          "type": "integer",
          "format": "int32",
          "description": "The target size of the volume, in GiB. Default is 2048."
        },
        "volumeType": {
          "description": "The volume type. This parameter can be HDD or SSD. Default is HDD.",
          "$ref": "#/$defs/VolumeType"
        }
      }
    },
    "AutoScalingParameters": {
      "type": "object",
      "description": "A Parameters to configure AutoScaling",
      "properties": {
        "targetedValueForMetric": {
          "type": "integer",
          "format": "int64",
          "description": "The target value of the metric a user expect to maintain for the cluster"
        },
        "maxWorkersForDatabase": {
          "type": "integer",
          "format": "int32",
          "description": "Maximum number of worker nodes as per this metrics can be scaled up to."
        },
        "maxWorkersPerBatch": {
          "type": "integer",
          "format": "int32",
          "description": "Maximum number of worker nodes as per this metrics can be scaled up to in one batch."
        },
        "minWorkersForDatabase": {
          "type": "integer",
          "format": "int32",
          "description": "Minimum number of worker nodes as per this metrics can be scaled down to."
        },
        "evaluationPeriod": {
          "type": "integer",
          "format": "int64",
          "description": "Period of metrics(in seconds) needs to be considered."
        },
        "minimumBlockCacheGb": {
          "type": "integer",
          "format": "int32",
          "description": "The amount of block cache, in Gigabytes, which the database should have."
        }
      }
    },
    "CustomInstanceTypes": {
      "type": "object",
      "description": "Custom VM Instance Types.",
      "properties": {
        "masterType": {
          "type": "string",
          "description": "Master VM Instance Type."
        },
        "workerType": {
          "type": "string",
          "description": "Worker VM Instance Type."
        },
        "gatewayType": {
          "type": "string",
          "description": "Gateway VM Instance Type."
        },
        "leaderType": {
          "type": "string",
          "description": "Leader VM Instance Type."
        },
        "edgeType": {
          "type": "string",
          "description": "Edge VM Instance Type."
        },
        "computeType": {
          "type": "string",
          "description": "Compute VM Instance Type."
        }
      }
    },
    "CustomRecipe": {
      "type": "object",
      "description": "Describe a custom recipe.",
      "required": [
        "names",
        "instanceGroup"
      ],
      "properties": {
        "names": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Name of the recipe."
        },
        "instanceGroup": {
          "description": "Instance group to apply the recipe to.",
          "$ref": "#/$defs/InstanceGroupType"
        }
      }
    },
    "Image": {
      "type": "object",
      "description": "Details of an Image.",
      "properties": {
        "id": {
          "type": "string",
          "description": "Image ID for the database."
        },
        "catalog": {
          "type": "string",
          "description": "Catalog name for the image."
        }
      }
    },
    "InstanceGroupType": {
      "type": "string",
      "description": "InstanceGroup Type.\n `WORKER` - WORKER value of the InstanceGroup name. `LEADER` - LEADER value of the InstanceGroup name. `MASTER` - MASTER value of the InstanceGroup name. `GATEWAY` - GATEWAY value of the InstanceGroup name. `STRONGMETA` - STRONGMETA value of the InstanceGroup name. `EDGE` - EDGE value of the InstanceGroup name. `COMPUTE` - COMPUTE value of the InstanceGroup name. `RESTWORKER` - RESTWORKER value of the InstanceGroup name.",
      "enum": [
        "WORKER",
        "LEADER",
        "MASTER",
        "GATEWAY",
        "STRONGMETA",
        "EDGE"
      ]
    },
    "KeyValuePair": {
      "type": "object",
      "description": "Generic key-value type, because map<> is not supported",
      "properties": {
        "key": {
          "type": "string",
          "description": "Key"
        },
        "value": {
          "type": "string",
          "description": "Value"
        }
      }
    },
    "ScaleType": {
      "type": "string",
      "description": "Scale type.\n `MICRO` - Create a 2-node cluster (1 gateway and 1 worker) with high availability disabled. `LIGHT` - Create a multi-node cluster with a light master and gateway instance type. `HEAVY` - Create a multi-node cluster with heavy master and gateway instance type.",
      "enum": [
        "MICRO",
        "LIGHT",
        "HEAVY"
      ]
    },
    "StorageType": {
      "type": "string",
      "description": "Storage type for clusters.\n `CLOUD_WITH_EPHEMERAL` - Cloud with ephemeral storage. `CLOUD` - Cloud storage without ephemeral storage. `HDFS` - HDFS storage.",
      "enum": [
        "CLOUD_WITH_EPHEMERAL",
        "CLOUD",
        "HDFS"
      ]
    },
    "VolumeEncryption": {
      "type": "object",
      "description": "Specify volume encryption key for instance group.",
      "required": [
        "encryptionKey",
        "instanceGroup"
      ],
      "properties": {
        "encryptionKey": {
          "type": "string",
          "description": "Encryption key."
        },
        "instanceGroup": {
          "description": "Instance group to apply the encryption key to.",
          "$ref": "#/$defs/InstanceGroupType"
        }
      }
    },
    "VolumeType": {
      "type": "string",
      "description": "Volume Type.\n `HDD` - Hard disk drives (HDD) volume type. Default is HDD. `SSD` - Solid disk drives (SSD) volume type. `LOCAL_SSD` - Local SSD volume type.",
      "enum": [
        "HDD",
        "SSD",
        "LOCAL_SSD"
      ]
    }
  }
}