{
  "form": [
    {
      "sectionName": "Connection",
      "children": [
        {
          "label": "Connection Mode",
          "configProperty": "datasourceConfiguration.connection.mode",
          "controlType": "DROP_DOWN",
          "initialValue": "READ_WRITE",
          "options": [
            {
              "label": "Read Only",
              "value": "READ_ONLY"
            },
            {
              "label": "Read / Write",
              "value": "READ_WRITE"
            }
          ]
        },
        {
          "label": "Connection Type",
          "configProperty": "datasourceConfiguration.connection.type",
          "initialValue": "DIRECT",
          "controlType": "DROP_DOWN",
          "options": [
            {
              "label": "Direct Connection",
              "value": "DIRECT"
            },
            {
              "label": "Replica set",
              "value": "REPLICA_SET"
            }
          ]
        },
        {
          "sectionName": null,
          "children": [
            {
              "label": "Host Address",
              "configProperty": "datasourceConfiguration.endpoints[*].host",
              "controlType": "KEYVALUE_ARRAY",
              "validationMessage": "Please enter a valid host",
              "validationRegex": "^((?![/:]).)*$"
            },
            {
              "label": "Port",
              "configProperty": "datasourceConfiguration.endpoints[*].port",
              "dataType": "NUMBER",
              "controlType": "KEYVALUE_ARRAY"
            }
          ]
        },
        {
          "label": "Default Database Name",
          "placeholder": "(Optional)",
          "configProperty": "datasourceConfiguration.connection.defaultDatabaseName",
          "controlType": "INPUT_TEXT"
        }
      ]
    },
    {
      "sectionName": "Authentication",
      "children": [
        {
          "label": "Database Name",
          "configProperty": "datasourceConfiguration.authentication.databaseName",
          "controlType": "INPUT_TEXT",
          "placeholderText": "Database name",
          "initialValue": "admin"
        },
        {
          "label": "Authentication Type",
          "configProperty": "datasourceConfiguration.authentication.authType",
          "controlType": "DROP_DOWN",
          "initialValue": "SCRAM_SHA_1",
          "options": [
            {
              "label": "SCRAM-SHA-1",
              "value": "SCRAM_SHA_1"
            },
            {
              "label": "SCRAM-SHA-256",
              "value": "SCRAM_SHA_256"
            },
            {
              "label": "MONGODB-CR",
              "value": "MONGODB_CR"
            }
          ]
        },
        {
          "sectionName": null,
          "children": [
            {
              "label": "Username",
              "configProperty": "datasourceConfiguration.authentication.username",
              "controlType": "INPUT_TEXT",
              "placeholderText": "Username"
            },
            {
              "label": "Password",
              "configProperty": "datasourceConfiguration.authentication.password",
              "dataType": "PASSWORD",
              "controlType": "INPUT_TEXT",
              "placeholderText": "Password",
              "encrypted": true
            }
          ]
        }
      ]
    },
    {
      "sectionName": "SSL (optional)",
      "children": [
        {
          "label": "Authentication Mechanism",
          "configProperty": "datasourceConfiguration.connection.ssl.authType",
          "controlType": "DROP_DOWN",
          "initialValue": "NO_SSL",
          "options": [
            {
              "label": "No SSL",
              "value": "NO_SSL"
            },
            {
              "label": "CA Certificate",
              "value": "CA_CERTIFICATE"
            },
            {
              "label": "Self Signed Certificate",
              "value": "SELF_SIGNED_CERTIFICATE"
            }
          ]
        },
        {
          "label": "CA Certificate",
          "configProperty": "datasourceConfiguration.connection.ssl.caCertificate",
          "controlType": "FILE_PICKER"
        },
        {
          "label": "PEM Certificate",
          "configProperty": "datasourceConfiguration.connection.ssl.pemCertificate",
          "controlType": "FILE_PICKER"
        }
      ]
    }
  ]
}
