omnata-plugin-devkit 0.3.7__tar.gz → 0.3.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/PKG-INFO +2 -2
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/pyproject.toml +2 -2
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/CONFIGURE_APIS.sql.jinja +2 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/NGROK_POST_TUNNEL_FIELDS.sql.jinja +6 -1
- omnata_plugin_devkit-0.3.8/src/omnata_plugin_devkit/jinja_templates/TUNNEL_TEST.sql.jinja +107 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/plugin_uploader.py +1 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/LICENSE +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/README.md +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/__init__.py +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/airbyte_wrapper.py +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/cli/__init__.py +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/development_session.py +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/initialiser.py +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/API_LIMITS.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/CONFIGURATION_FORM.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/CONNECTION_FORM.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/CONNECTION_TEST.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/CONSTRUCT_FORM_OPTION.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/CREATE_BILLING_EVENTS.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/CREATE_GENERIC_SECRET_OBJECT.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/CREATE_GENERIC_SECRET_OBJECT_FROM_EXISTING.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/CREATE_NETWORK_RULE_OBJECT.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/CREATE_NETWORK_RULE_OBJECT_FROM_EXISTING.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/CREATE_OAUTH_SECRET_OBJECT.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/INBOUND_LIST_STREAMS.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/NETWORK_ADDRESSES.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/OUTBOUND_RECORD_VALIDATOR.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/PENDING_API_CONFIGURATION.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/POST_INSTALL_ACTIONS.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/RETRIEVE_NETWORK_RULE_OBJECT.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/RETRIEVE_SECRETS.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/SYNC.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/TEST_CALLBACK.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/TEST_OAUTH_TOKEN_EXISTS.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/UPDATE_API_CONFIGURATION.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/UPDATE_GENERIC_SECRET_OBJECT.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/UPDATE_GENERIC_SECRET_OBJECT_OLD.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/UPDATE_NETWORK_RULE_OBJECT.sql.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/jinja_templates/manifest.yml.jinja +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/native_app_packaging.py +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/plugin_registration.py +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/plugin_template/icon.svg +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/plugin_template/plugin.py +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/plugin_template/requirements.txt +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/streamlit/plugin_configuration.py +0 -0
- {omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/test_step_definitions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: omnata-plugin-devkit
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.8
|
|
4
4
|
Summary:
|
|
5
5
|
Author: James Weakley
|
|
6
6
|
Author-email: james.weakley@omnata.com
|
|
@@ -10,7 +10,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
10
10
|
Requires-Dist: behave (>=1.2,<2.0)
|
|
11
11
|
Requires-Dist: behave_pandas (>=0.5.0,<0.6.0)
|
|
12
12
|
Requires-Dist: jinja2 (>=3,<4)
|
|
13
|
-
Requires-Dist: omnata-plugin-runtime (>=0.
|
|
13
|
+
Requires-Dist: omnata-plugin-runtime (>=0.3.3)
|
|
14
14
|
Requires-Dist: omnata_cli (>=0.2.0,<0.3.0)
|
|
15
15
|
Requires-Dist: pandas (==2.1.4)
|
|
16
16
|
Requires-Dist: pydantic (>=1,<2)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "omnata-plugin-devkit"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.8"
|
|
4
4
|
description = ""
|
|
5
5
|
authors = ["James Weakley <james.weakley@omnata.com>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -9,7 +9,7 @@ packages = [{ include = "omnata_plugin_devkit", from = "src" }]
|
|
|
9
9
|
[tool.poetry.dependencies]
|
|
10
10
|
python = "~3.10"
|
|
11
11
|
omnata_cli = "^0.2.0"
|
|
12
|
-
omnata-plugin-runtime = "
|
|
12
|
+
omnata-plugin-runtime = ">=0.3.3"
|
|
13
13
|
pandas = "2.1.4"
|
|
14
14
|
jinja2 = "^3"
|
|
15
15
|
pydantic = "^1"
|
|
@@ -22,13 +22,18 @@ logger = getLogger(__name__)
|
|
|
22
22
|
def run(session,connection_method,connection_parameters,oauth_secret_name,other_secrets_name,function_name):
|
|
23
23
|
try:
|
|
24
24
|
logger.info('plugin entrypoint wrapper')
|
|
25
|
-
from omnata_plugin_runtime.plugin_entrypoints import PluginEntrypoint
|
|
25
|
+
from omnata_plugin_runtime.plugin_entrypoints import PluginEntrypoint, normalise_nulls
|
|
26
26
|
logger.info('importing plugin {{plugin_class_name}} from module {{plugin_class_module}}')
|
|
27
27
|
entrypoint = PluginEntrypoint(session=session,
|
|
28
28
|
plugin_fqn='{{plugin_fqn}}',
|
|
29
29
|
module_name='{{plugin_class_module}}',
|
|
30
30
|
class_name='{{plugin_class_name}}'
|
|
31
31
|
)
|
|
32
|
+
oauth_secret_name = normalise_nulls(oauth_secret_name)
|
|
33
|
+
other_secrets_name = normalise_nulls(other_secrets_name)
|
|
34
|
+
# no idea why this sometimes happens, I blame some versions of the snowflake python connector
|
|
35
|
+
if oauth_secret_name=='None':
|
|
36
|
+
oauth_secret_name=None
|
|
32
37
|
result = entrypoint.ngrok_post_tunnel_fields(connection_method,connection_parameters,oauth_secret_name,other_secrets_name,function_name)
|
|
33
38
|
logger.debug(f'result from plugin: {result}')
|
|
34
39
|
return {
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
create or replace procedure PLUGIN.TUNNEL_TEST(TUNNEL_TYPE VARCHAR,
|
|
2
|
+
OTHER_SECRETS_NAME VARCHAR)
|
|
3
|
+
returns object
|
|
4
|
+
language python
|
|
5
|
+
RUNTIME_VERSION = '3.10'
|
|
6
|
+
EXTERNAL_ACCESS_INTEGRATIONS = ()
|
|
7
|
+
PACKAGES = ({{packages}})
|
|
8
|
+
SECRETS = ()
|
|
9
|
+
IMPORTS = ('/app.zip')
|
|
10
|
+
HANDLER = 'run'
|
|
11
|
+
execute as owner
|
|
12
|
+
as
|
|
13
|
+
$$
|
|
14
|
+
from logging import getLogger
|
|
15
|
+
from omnata_plugin_runtime.logging import log_exception
|
|
16
|
+
import json
|
|
17
|
+
from urllib3.contrib.pyopenssl import PyOpenSSLContext
|
|
18
|
+
import OpenSSL.crypto
|
|
19
|
+
import urllib3
|
|
20
|
+
import ssl
|
|
21
|
+
import certifi
|
|
22
|
+
logger = getLogger(__name__)
|
|
23
|
+
def run(session,tunnel_type:str,other_secrets_name:str):
|
|
24
|
+
try:
|
|
25
|
+
logger.info('plugin entrypoint wrapper')
|
|
26
|
+
if tunnel_type!='ngrok':
|
|
27
|
+
raise ValueError('Only ngrok tunnels are supported')
|
|
28
|
+
from omnata_plugin_runtime.plugin_entrypoints import PluginEntrypoint
|
|
29
|
+
logger.info('importing plugin {{plugin_class_name}} from module {{plugin_class_module}}')
|
|
30
|
+
entrypoint = PluginEntrypoint(session=session,
|
|
31
|
+
plugin_fqn='{{plugin_fqn}}',
|
|
32
|
+
module_name='{{plugin_class_module}}',
|
|
33
|
+
class_name='{{plugin_class_name}}'
|
|
34
|
+
)
|
|
35
|
+
secrets = entrypoint.get_secrets(None,other_secrets_name)
|
|
36
|
+
if "ngrok_endpoint_host" not in secrets:
|
|
37
|
+
raise ValueError("No endpoint host available for tunnel test")
|
|
38
|
+
if "ngrok_endpoint_port" not in secrets:
|
|
39
|
+
raise ValueError("No endpoint port available for tunnel test")
|
|
40
|
+
if "ngrok_client_certificate" not in secrets:
|
|
41
|
+
raise ValueError("No client certificate available for tunnel test")
|
|
42
|
+
if "ngrok_client_key" not in secrets:
|
|
43
|
+
raise ValueError("No client key available for tunnel test")
|
|
44
|
+
ngrok_endpoint_host = secrets['ngrok_endpoint_host'].value
|
|
45
|
+
ngrok_endpoint_port = int(secrets['ngrok_endpoint_port'].value)
|
|
46
|
+
if ngrok_endpoint_port != 443:
|
|
47
|
+
raise ValueError('Currently we always expect port 443')
|
|
48
|
+
ngrok_client_certificate = secrets['ngrok_client_certificate'].value
|
|
49
|
+
ngrok_client_key = secrets['ngrok_client_key'].value
|
|
50
|
+
return_data = {}
|
|
51
|
+
ssl_context = create_ssl_context(ngrok_client_certificate, ngrok_client_key)
|
|
52
|
+
http = urllib3.PoolManager(ssl_context=ssl_context)
|
|
53
|
+
url = f'https://{ngrok_endpoint_host}/'
|
|
54
|
+
try:
|
|
55
|
+
response=http.request('GET',url)
|
|
56
|
+
except urllib3.exceptions.MaxRetryError as max_retry_error:
|
|
57
|
+
if isinstance(max_retry_error.reason, urllib3.exceptions.SSLError):
|
|
58
|
+
ssl_error:urllib3.exceptions.SSLError = max_retry_error.reason
|
|
59
|
+
if 'sslv3 alert bad certificate' in str(ssl_error):
|
|
60
|
+
logger.exception("Client certificate was not valid")
|
|
61
|
+
return_data['mtls_success'] = False
|
|
62
|
+
return_data['mtls_failure_reason'] = "Client certificate was not valid. Contact Omnata Support for assistance."
|
|
63
|
+
elif 'certificate verify failed' in str(ssl_error):
|
|
64
|
+
logger.exception("Server certificate was not trusted")
|
|
65
|
+
return_data['mtls_success'] = False
|
|
66
|
+
return_data['mtls_failure_reason'] = "Server certificate was not trusted. Contact Omnata Support for assistance."
|
|
67
|
+
else:
|
|
68
|
+
raise
|
|
69
|
+
elif isinstance(max_retry_error.reason, urllib3.exceptions.ProtocolError):
|
|
70
|
+
return_data['mtls_success'] = True
|
|
71
|
+
else:
|
|
72
|
+
raise
|
|
73
|
+
|
|
74
|
+
logger.info(f'result from tunnel test : {return_data}')
|
|
75
|
+
return {
|
|
76
|
+
"success": True,
|
|
77
|
+
"data": return_data
|
|
78
|
+
}
|
|
79
|
+
except Exception as exception:
|
|
80
|
+
log_exception(exception,logger)
|
|
81
|
+
return {
|
|
82
|
+
"success": False,
|
|
83
|
+
"error": f"TUNNEL_TEST: {str(exception)}"
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
def create_ssl_context(cert_str, key_str):
|
|
87
|
+
# Load client certificate and key
|
|
88
|
+
certificate = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, cert_str)
|
|
89
|
+
private_key = OpenSSL.crypto.load_privatekey(OpenSSL.crypto.FILETYPE_PEM, key_str)
|
|
90
|
+
|
|
91
|
+
# Create a PyOpenSSL Context
|
|
92
|
+
ssl_context = PyOpenSSLContext(ssl.PROTOCOL_TLSv1_2)
|
|
93
|
+
|
|
94
|
+
# Use the certificate and key in the context
|
|
95
|
+
ssl_context._ctx.use_certificate(certificate)
|
|
96
|
+
ssl_context._ctx.use_privatekey(private_key)
|
|
97
|
+
ssl_context.verify_mode = ssl.VerifyMode.CERT_REQUIRED
|
|
98
|
+
ssl_context.load_verify_locations(cafile=certifi.where())
|
|
99
|
+
|
|
100
|
+
return ssl_context
|
|
101
|
+
|
|
102
|
+
$$
|
|
103
|
+
;
|
|
104
|
+
|
|
105
|
+
grant usage on procedure PLUGIN.TUNNEL_TEST(VARCHAR,
|
|
106
|
+
VARCHAR)
|
|
107
|
+
to application role OMNATA_MANAGEMENT;
|
|
File without changes
|
|
File without changes
|
{omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/cli/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{omnata_plugin_devkit-0.3.7 → omnata_plugin_devkit-0.3.8}/src/omnata_plugin_devkit/initialiser.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|