mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
feat(ssh_tunnel): Import/Export Databases with SSHTunnel credentials (#23099)
This commit is contained in:
@@ -122,6 +122,30 @@ class ImportExportRestApi(BaseSupersetApi):
|
||||
in the following format:
|
||||
`{"databases/MyDatabase.yaml": "my_password"}`.
|
||||
type: string
|
||||
ssh_tunnel_passwords:
|
||||
description: >-
|
||||
JSON map of passwords for each ssh_tunnel associated to a
|
||||
featured database in the ZIP file. If the ZIP includes a
|
||||
ssh_tunnel config in the path `databases/MyDatabase.yaml`,
|
||||
the password should be provided in the following format:
|
||||
`{"databases/MyDatabase.yaml": "my_password"}`.
|
||||
type: string
|
||||
ssh_tunnel_private_keys:
|
||||
description: >-
|
||||
JSON map of private_keys for each ssh_tunnel associated to a
|
||||
featured database in the ZIP file. If the ZIP includes a
|
||||
ssh_tunnel config in the path `databases/MyDatabase.yaml`,
|
||||
the private_key should be provided in the following format:
|
||||
`{"databases/MyDatabase.yaml": "my_private_key"}`.
|
||||
type: string
|
||||
ssh_tunnel_private_key_passwords:
|
||||
description: >-
|
||||
JSON map of private_key_passwords for each ssh_tunnel associated
|
||||
to a featured database in the ZIP file. If the ZIP includes a
|
||||
ssh_tunnel config in the path `databases/MyDatabase.yaml`,
|
||||
the private_key should be provided in the following format:
|
||||
`{"databases/MyDatabase.yaml": "my_private_key_password"}`.
|
||||
type: string
|
||||
responses:
|
||||
200:
|
||||
description: Assets import result
|
||||
@@ -158,7 +182,28 @@ class ImportExportRestApi(BaseSupersetApi):
|
||||
if "passwords" in request.form
|
||||
else None
|
||||
)
|
||||
ssh_tunnel_passwords = (
|
||||
json.loads(request.form["ssh_tunnel_passwords"])
|
||||
if "ssh_tunnel_passwords" in request.form
|
||||
else None
|
||||
)
|
||||
ssh_tunnel_private_keys = (
|
||||
json.loads(request.form["ssh_tunnel_private_keys"])
|
||||
if "ssh_tunnel_private_keys" in request.form
|
||||
else None
|
||||
)
|
||||
ssh_tunnel_priv_key_passwords = (
|
||||
json.loads(request.form["ssh_tunnel_private_key_passwords"])
|
||||
if "ssh_tunnel_private_key_passwords" in request.form
|
||||
else None
|
||||
)
|
||||
|
||||
command = ImportAssetsCommand(contents, passwords=passwords)
|
||||
command = ImportAssetsCommand(
|
||||
contents,
|
||||
passwords=passwords,
|
||||
ssh_tunnel_passwords=ssh_tunnel_passwords,
|
||||
ssh_tunnel_private_keys=ssh_tunnel_private_keys,
|
||||
ssh_tunnel_priv_key_passwords=ssh_tunnel_priv_key_passwords,
|
||||
)
|
||||
command.run()
|
||||
return self.response(200, message="OK")
|
||||
|
||||
Reference in New Issue
Block a user