{ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Postgresql datasource", "description": "A schema defining postgresql datasource", "type": "object", "tj:version": "1.0.0", "tj:source": { "name": "PostgreSQL", "kind": "postgresql", "type": "database" }, "properties": { "connection_type": { "type": "string", "title": "Connection type", "description": "Single select dropdown for connection_type", "enum": ["manual", "string"], "default": "manual" }, "host": { "type": "string", "title": "Host", "description": "Enter host", "default": "localhost" }, "port": { "type": "number", "title": "Port", "description": "Enter port", "default": 5432 }, "database": { "type": "string", "title": "Database name", "description": "Name of the database" }, "username": { "type": "string", "title": "Username", "description": "Enter username" }, "password": { "type": "string", "title": "Password", "description": "Enter password" }, "ssl_enabled": { "type": "boolean", "title": "SSL/TLS", "description": "Connect using SSL", "default": true }, "ssl_certificate": { "type": "string", "title": "SSL certificate", "description": "Single select dropdown for choosing certificates", "enum": ["ca_certificate", "self_signed", "none"], "default": "none" }, "connection_string": { "type": "string", "title": "Connection string (encoded)", "description": "postgres://username:password@hostname:port/database?sslmode=require" }, "ca_cert": { "type": "string", "title": "CA Cert", "description": "Enter ca certificate" }, "client_key": { "type": "string", "title": "Client Key", "description": "Enter client key" }, "client_cert": { "type": "string", "title": "Client Cert", "description": "Enter client certificate" }, "root_cert": { "type": "string", "title": "Root Cert", "description": "Enter root certificate" }, "allow_dynamic_connection_parameters": { "type": "boolean", "title": "Allow dynamic connection parameters", "description": "Turning this on will allow dynamically setting host name and database from application", "default": false }, "ssh_enabled": { "type": "string", "title": "SSH Tunnel", "description": "Connect through an SSH server", "enum": ["enabled", "disabled"], "default": "disabled" }, "ssh_host": { "type": "string", "title": "SSH Host" }, "ssh_port": { "type": "number", "title": "SSH Port", "default": 22 }, "ssh_username": { "type": "string", "title": "SSH Username" }, "ssh_auth_type": { "type": "string", "title": "SSH Authentication Type", "enum": ["private_key", "password"], "default": "private_key" }, "ssh_private_key": { "type": "string", "title": "SSH Private Key" }, "ssh_password": { "type": "string", "title": "SSH Password" }, "ssh_passphrase": { "type": "string", "title": "SSH Passphrase" } }, "tj:encrypted": [ "password", "ca_cert", "client_key", "client_cert", "root_cert", "connection_string", "ssh_private_key", "ssh_password", "ssh_passphrase" ], "required": ["connection_type"], "allOf": [ { "if": { "properties": { "connection_type": { "const": "manual" } } }, "then": { "required": ["host", "port", "username", "password"], "allOf": [ { "if": { "properties": { "ssl_enabled": { "const": true } } }, "then": { "required": ["ssl_certificate"], "allOf": [ { "if": { "properties": { "ssl_certificate": { "const": "ca_certificate" } } }, "then": { "required": ["ca_cert"] } }, { "if": { "properties": { "ssl_certificate": { "const": "self_signed" } } }, "then": { "required": ["client_key", "client_cert", "root_cert"] } } ] } } ] } }, { "if": { "properties": { "connection_type": { "const": "string" } } }, "then": { "required": ["connection_string"] } }, { "if": { "properties": { "ssh_enabled": { "const": "enabled" } } }, "then": { "required": [] } } ], "tj:ui:properties": { "connection_type": { "order": 1, "$ref": "#/properties/connection_type", "key": "connection_type", "label": "Connection type", "description": "Single select dropdown for connection_type", "widget": "dropdown-component-flip", "list": [ { "name": "Manual connection", "value": "manual" }, { "name": "Connection string (encoded)", "value": "string" } ] }, "manual": { "host": { "order": 10, "$ref": "#/properties/host", "key": "host", "label": "Host", "description": "Enter host", "widget": "text-v3", "required": true }, "port": { "order": 20, "$ref": "#/properties/port", "key": "port", "label": "Port", "description": "Enter port", "widget": "text-v3", "required": true, "help_text": "Default PostgreSQL port is 5432" }, "database": { "order": 30, "$ref": "#/properties/database", "key": "database", "label": "Database", "description": "Enter name of the database", "widget": "text-v3" }, "username": { "order": 40, "$ref": "#/properties/username", "key": "username", "label": "Username", "description": "Enter username", "widget": "text-v3", "required": true }, "password": { "order": 50, "$ref": "#/properties/password", "key": "password", "label": "Password", "description": "Enter password", "widget": "password-v3", "required": true, "help_text": "Supports secrets (e.g.,{{secrets.db_password}})" }, "connection_options": { "order": 60, "$ref": "#/properties/connection_options", "key": "connection_options", "label": "Connection options", "widget": "react-component-headers" }, "ssl_enabled": { "order": 70, "$ref": "#/properties/ssl_enabled", "key": "ssl_enabled", "label": "SSL/TLS", "description": "Connect using SSL", "widget": "toggle-flip", "help_text": "Enable encrypted connections to PostgreSQL server", "default": true, "true": { "ssl_certificate": { "order": 80, "$ref": "#/properties/ssl_certificate", "key": "ssl_certificate", "label": "SSL certificate", "description": "Single select dropdown for choosing certificates", "widget": "dropdown-component-flip", "list": [ { "value": "ca_certificate", "name": "CA certificate" }, { "value": "self_signed", "name": "Self-signed certificate" }, { "value": "none", "name": "None" } ] }, "ca_certificate": { "ca_cert": { "order": 90, "$ref": "#/properties/ca_cert", "key": "ca_cert", "label": "CA cert", "description": "Enter ca certificate", "widget": "password-v3-textarea" } }, "self_signed": { "client_key": { "order": 90, "$ref": "#/properties/client_key", "key": "client_key", "label": "Client key", "description": "Enter client key", "widget": "password-v3-textarea" }, "client_cert": { "order": 100, "$ref": "#/properties/client_cert", "key": "client_cert", "label": "Client cert", "description": "Enter client certificate", "widget": "password-v3-textarea" }, "root_cert": { "order": 110, "$ref": "#/properties/root_cert", "key": "root_cert", "label": "Root cert", "description": "Enter root certificate", "widget": "password-v3-textarea" } }, "none": {} }, "false": {} }, "ssh_enabled": { "order": 120, "$ref": "#/properties/ssh_enabled", "key": "ssh_enabled", "label": "SSH tunnel", "description": "Connect through an SSH server", "help_text": "Connect through an SSH server to access databases in private networks", "widget": "toggle-flip", "default": "disabled", "enabled": { "ssh_host": { "order": 130, "$ref": "#/properties/ssh_host", "key": "ssh_host", "label": "SSH host", "description": "ssh.example.com", "widget": "text-v3", "help_text": "SSH server hostname or IP address" }, "ssh_port": { "order": 140, "$ref": "#/properties/ssh_port", "key": "ssh_port", "label": "SSH port", "description": "22", "widget": "text-v3", "help_text": "Default SSH port is 22" }, "ssh_username": { "order": 150, "$ref": "#/properties/ssh_username", "key": "ssh_username", "label": "SSH username", "description": "SSH Username", "widget": "text-v3" }, "ssh_auth_type": { "order": 175, "$ref": "#/properties/ssh_auth_type", "key": "ssh_auth_type", "label": "Authentication type", "widget": "dropdown-component-flip", "default": "private_key", "list": [ { "value": "private_key", "name": "Private Key" }, { "value": "password", "name": "Password" } ] }, "private_key": { "ssh_private_key": { "order": 180, "$ref": "#/properties/ssh_private_key", "key": "ssh_private_key", "label": "SSH private key", "widget": "password-v3-textarea" }, "ssh_passphrase": { "order": 190, "$ref": "#/properties/ssh_passphrase", "key": "ssh_passphrase", "label": "SSH passphrase", "widget": "password-v3" } }, "password": { "ssh_password": { "order": 180, "$ref": "#/properties/ssh_password", "key": "ssh_password", "label": "SSH password", "widget": "password-v3" } } }, "disabled": {} }, "allow_dynamic_connection_parameters": { "order": 200, "$ref": "#/properties/allow_dynamic_connection_parameters", "key": "allow_dynamic_connection_parameters", "label": "Allow dynamic connection parameters", "description": "Turning this on will allow dynamically setting host name and database from application", "widget": "toggle-v2", "help_text": "Enable this to override the default host and database at query runtime" } }, "string": { "connection_string": { "order": 2, "$ref": "#/properties/connection_string", "key": "connection_string", "label": "Connection string (encoded)", "description": "postgres://username:password@hostname:port/database?sslmode=require", "widget": "password-v3-textarea", "required": true, "help_text":"e.g., postgresql://admin:p%40ssword@localhost:5432/my%23db. Encode special characters using a URL encoder." }, "host": { "order": 10, "$ref": "#/properties/host", "key": "host", "label": "Host", "description": "Enter host", "widget": "text-v3" }, "port": { "order": 20, "$ref": "#/properties/port", "key": "port", "label": "Port", "description": "Enter port", "widget": "text-v3", "help_text": "Default PostgreSQL port is 5432" }, "database": { "order": 30, "$ref": "#/properties/database", "key": "database", "label": "Database", "description": "Enter name of the database", "widget": "text-v3" }, "username": { "order": 40, "$ref": "#/properties/username", "key": "username", "label": "Username", "description": "Enter username", "widget": "text-v3" }, "password": { "order": 50, "$ref": "#/properties/password", "key": "password", "label": "Password", "description": "Enter password", "widget": "password-v3", "help_text": "Supports secrets (e.g.,{{secrets.db_password}})" }, "connection_options": { "order": 60, "$ref": "#/properties/connection_options", "key": "connection_options", "label": "Connection options", "widget": "react-component-headers" }, "ssl_enabled": { "order": 70, "$ref": "#/properties/ssl_enabled", "key": "ssl_enabled", "label": "SSL/TLS", "description": "Connect using SSL", "widget": "toggle-flip", "help_text": "Enable encrypted connections to PostgreSQL server", "default": true, "true": { "ssl_certificate": { "order": 80, "$ref": "#/properties/ssl_certificate", "key": "ssl_certificate", "label": "SSL certificate", "description": "Single select dropdown for choosing certificates", "widget": "dropdown-component-flip", "list": [ { "value": "ca_certificate", "name": "CA certificate" }, { "value": "self_signed", "name": "Self-signed certificate" }, { "value": "none", "name": "None" } ] }, "ca_certificate": { "ca_cert": { "order": 90, "$ref": "#/properties/ca_cert", "key": "ca_cert", "label": "CA cert", "description": "Enter ca certificate", "widget": "password-v3-textarea" } }, "self_signed": { "client_key": { "order": 90, "$ref": "#/properties/client_key", "key": "client_key", "label": "Client key", "description": "Enter client key", "widget": "password-v3-textarea" }, "client_cert": { "order": 100, "$ref": "#/properties/client_cert", "key": "client_cert", "label": "Client cert", "description": "Enter client certificate", "widget": "password-v3-textarea" }, "root_cert": { "order": 110, "$ref": "#/properties/root_cert", "key": "root_cert", "label": "Root cert", "description": "Enter root certificate", "widget": "password-v3-textarea" } }, "none": {} }, "false": {} }, "ssh_enabled": { "order": 120, "$ref": "#/properties/ssh_enabled", "key": "ssh_enabled", "label": "SSH tunnel", "description": "Connect through an SSH server", "widget": "toggle-flip", "help_text": "Connect through an SSH server to access databases in private networks", "default": "disabled", "enabled": { "ssh_host": { "order": 130, "$ref": "#/properties/ssh_host", "key": "ssh_host", "label": "SSH host", "description": "ssh.example.com", "widget": "text-v3", "help_text": "SSH server hostname or IP address" }, "ssh_port": { "order": 140, "$ref": "#/properties/ssh_port", "key": "ssh_port", "label": "SSH port", "description": "22", "widget": "text-v3", "help_text": "Default SSH port is 22" }, "ssh_username": { "order": 150, "$ref": "#/properties/ssh_username", "key": "ssh_username", "label": "SSH username", "description": "SSH Username", "widget": "text-v3" }, "ssh_auth_type": { "order": 175, "$ref": "#/properties/ssh_auth_type", "key": "ssh_auth_type", "label": "Authentication type", "widget": "dropdown-component-flip", "default": "private_key", "list": [ { "value": "private_key", "name": "Private Key" }, { "value": "password", "name": "Password" } ] }, "private_key": { "ssh_private_key": { "order": 180, "$ref": "#/properties/ssh_private_key", "key": "ssh_private_key", "label": "SSH private key", "widget": "password-v3-textarea" }, "ssh_passphrase": { "order": 190, "$ref": "#/properties/ssh_passphrase", "key": "ssh_passphrase", "label": "SSH passphrase", "widget": "password-v3" } }, "password": { "ssh_password": { "order": 180, "$ref": "#/properties/ssh_password", "key": "ssh_password", "label": "SSH password", "widget": "password-v3" } } }, "disabled": {} }, "allow_dynamic_connection_parameters": { "order": 130, "$ref": "#/properties/allow_dynamic_connection_parameters", "key": "allow_dynamic_connection_parameters", "label": "Allow dynamic connection parameters", "description": "Turning this on will allow dynamically setting host name and database from application", "widget": "toggle-v2", "help_text": "Enable this to override the default host and database at query runtime" } } } }