Skip to content

Commit 2f476ff

Browse files
author
Thibaud Baas
committed
FM: Install JDBC Driver SetupAction
1 parent 0b4340f commit 2f476ff

1 file changed

Lines changed: 28 additions & 4 deletions

File tree

dataikuapi/fm/instancesettingstemplates.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ def __init__(self, setupActionType, params=None):
5555
@staticmethod
5656
def add_authorized_key(ssh_key):
5757
"""
58-
Return a ADD_AUTHORIZED_KEY SetupAction
58+
Return a ADD_AUTHORIZED_KEY FMSetupAction
5959
"""
6060
return FMSetupAction(FMSetupActionType.ADD_AUTHORIZED_KEY, {"sshKey": ssh_key })
6161

6262
@staticmethod
6363
def run_ansible_task(stage, yaml_string):
6464
"""
65-
Return a RUN_ANSIBLE_TASK SetupAction
65+
Return a RUN_ANSIBLE_TASK FMSetupAction
6666
6767
:param object stage: a :class:`dataikuapi.fm.instancesettingstemplates.FMSetupActionStage`
6868
:param str yaml_string: a yaml encoded string defining the ansibles tasks to run
@@ -72,7 +72,7 @@ def run_ansible_task(stage, yaml_string):
7272
@staticmethod
7373
def install_system_packages(packages):
7474
"""
75-
Return an INSTALL_SYSTEM_PACKAGES SetupAction
75+
Return an INSTALL_SYSTEM_PACKAGES FMSetupAction
7676
7777
:param list packages: List of packages to install
7878
"""
@@ -81,13 +81,28 @@ def install_system_packages(packages):
8181
@staticmethod
8282
def setup_advanced_security(basic_headers = True, hsts = False):
8383
"""
84-
Return an SETUP_ADVANCED_SECURITY SetupAction
84+
Return an SETUP_ADVANCED_SECURITY FMSetupAction
8585
8686
:param boolean basic_headers: Optional, Prevent browsers to render Web content served by DSS to be embedded into a frame, iframe, embed or object tag. Defaults to True
8787
:param boolean hsts: Optional, Enforce HTTP Strict Transport Security. Defaults to False
8888
"""
8989
return FMSetupAction(FMSetupActionType.SETUP_ADVANCED_SECURITY, {"basic_headers": basic_headers, "hsts": hsts})
9090

91+
@staticmethod
92+
def install_jdbc_driver(database_type, url, paths_in_archive=None, http_headers=None, http_username=None, http_password=None, datadir_subdirectory=None):
93+
"""
94+
Return a INSTALL_JDBC_DRIVER FMSetupAction
95+
96+
:param object database_type: a :class:`dataikuapi.fm.instancesettingstemplates.FMSetupActionAddJDBCDriverDatabaseType`
97+
:param str url: The full address to the driver. Supports http(s)://, s3://, abs:// or file:// endpoints
98+
:param list paths_in_archive: Optional, must be used when the driver is shipped as a tarball or a ZIP file. Add here all the paths to find the JAR files in the driver archive. Paths are relative to the top of the archive. Wildcards are supported.
99+
:param dict http_headers: Optional, If you download the driver from a HTTP(S) endpoint, add here the headers you want to add to the query. This setting is ignored for any other type of download.
100+
:param str http_username: Optional, If the HTTP(S) endpoint expect a Basic Authentication, add here the username. To explicitely specify which Assigned Identity use if the machine have several, set the client_id here. To authenticate with a SAS Token on Azure Blob Storage (not recommended), use "token" as the value here.
101+
:param str http_password: Optional, If the HTTP(S) endpoint expect a Basic Authentication, add here the password. To authenticate with a SAS Token on Azure Blob Storage (not recommended), store the token in this field.
102+
:param str datadir_subdirectory: Optional, Some drivers are shipped with a high number of JAR files along with them. In that case, you might want to install them under an additional level in the DSS data directory. Set the name of this subdirectory here. Not required for most drivers.
103+
"""
104+
return FMSetupAction(FMSetupActionType.INSTALL_JDBC_DRIVER, {"url": url, "dbType": database_type.value, "pathsInArchive": paths_in_archive, "headers": http_headers, "username": http_username, "password": http_password, "subpathInDatadir": datadir_subdirectory})
105+
91106
class FMSetupActionType(Enum):
92107
RUN_ANSIBLE_TASKS="RUN_ANSIBLE_TASKS"
93108
INSTALL_SYSTEM_PACKAGES="INSTALL_SYSTEM_PACKAGES"
@@ -106,3 +121,12 @@ class FMSetupActionStage(Enum):
106121
after_dss_startup="after_dss_startup"
107122
after_install="after_install"
108123
before_install="before_install"
124+
125+
class FMSetupActionAddJDBCDriverDatabaseType(Enum):
126+
mysql="mysql"
127+
mssql="mssql"
128+
oracle="oracle"
129+
mariadb="mariadb"
130+
snowflake="snowflake"
131+
athena="athena"
132+
bigquery="bigquery"

0 commit comments

Comments
 (0)