From ced73059e3cd54c806f097f1815a558b2991bb02 Mon Sep 17 00:00:00 2001 From: Shashank Shekhar Date: Wed, 26 Feb 2025 18:20:52 +0530 Subject: [PATCH] feat: oauth support in databricks destination --- .../destinations/deltalake/db-config.json | 6 ++- .../destinations/deltalake/schema.json | 46 +++++++++++++++++-- .../destinations/deltalake/ui-config.json | 39 +++++++++++++++- 3 files changed, 85 insertions(+), 6 deletions(-) diff --git a/src/configurations/destinations/deltalake/db-config.json b/src/configurations/destinations/deltalake/db-config.json index 4ff6f7a51..cabb0c9a2 100644 --- a/src/configurations/destinations/deltalake/db-config.json +++ b/src/configurations/destinations/deltalake/db-config.json @@ -26,6 +26,9 @@ "port", "path", "token", + "useOauth", + "oauthClientId", + "oauthClientSecret", "catalog", "namespace", "bucketProvider", @@ -130,7 +133,8 @@ "accountKey", "sasToken", "credentials", - "token" + "token", + "oauthClientSecret" ], "supportedConnectionModes": { "android": ["cloud"], diff --git a/src/configurations/destinations/deltalake/schema.json b/src/configurations/destinations/deltalake/schema.json index f8f248f53..f9019f3a8 100644 --- a/src/configurations/destinations/deltalake/schema.json +++ b/src/configurations/destinations/deltalake/schema.json @@ -16,10 +16,6 @@ "type": "string", "pattern": "(^env[.].+)|^(.{1,100})$" }, - "token": { - "type": "string", - "pattern": "(^env[.].+)|^(.{1,100})$" - }, "catalog": { "type": "string", "pattern": "(^env[.].*)|^(.*)$" @@ -912,6 +908,48 @@ } }, "allOf": [ + { + "if": { + "properties": { + "useOauth": { + "const": false + } + }, + "required": ["useOauth"] + }, + "then": { + "properties": { + "token": { + "type": "string", + "pattern": "(^env[.].+)|^(.{1,100})$" + } + }, + "required": ["token"] + } + }, + { + "if": { + "properties": { + "useOauth": { + "const": true + } + }, + "required": ["useOauth"] + }, + "then": { + "properties": { + "oauthClientId": { + "type": "string", + "pattern": "^(.{1,100})$" + }, + "oauthClientSecret": { + "type": "string", + "pattern": "^(.{1,100})$" + } + }, + "required": ["oauthClientId", "oauthClientSecret"] + } + }, { "if": { "properties": { diff --git a/src/configurations/destinations/deltalake/ui-config.json b/src/configurations/destinations/deltalake/ui-config.json index 4fcc8499b..545e7303d 100644 --- a/src/configurations/destinations/deltalake/ui-config.json +++ b/src/configurations/destinations/deltalake/ui-config.json @@ -30,6 +30,12 @@ "placeholder": "sql/protocolv1/o// or /sql/1.0/endpoints/", "required": true }, + { + "type": "checkbox", + "label": "Use M2M OAuth", + "value": "useOauth", + "default": false + }, { "type": "textInput", "label": "Personal Access Token", @@ -38,7 +44,38 @@ "regexErrorMessage": "Invalid Access Token", "placeholder": "e.g: ", "required": true, - "secret": true + "secret": true, + "preRequisiteField": { + "name": "useOauth", + "selectedValue": false + } + }, + { + "type": "textInput", + "label": "Client ID", + "value": "oauthClientId", + "regex": "^(.{1,100})$", + "regexErrorMessage": "Invalid Client ID", + "placeholder": "e.g: ", + "required": true, + "preRequisiteField": { + "name": "useOauth", + "selectedValue": true + } + }, + { + "type": "textInput", + "label": "Client Secret", + "value": "oauthClientSecret", + "regex": "^(.{1,100})$", + "regexErrorMessage": "Invalid Client Secret", + "placeholder": "e.g: ", + "required": true, + "secret": true, + "preRequisiteField": { + "name": "useOauth", + "selectedValue": true + } }, { "type": "checkbox",