omnata-plugin-runtime 0.2.89__py3-none-any.whl → 0.2.91__py3-none-any.whl
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_runtime/configuration.py +19 -1
- omnata_plugin_runtime/plugin_entrypoints.py +33 -1
- {omnata_plugin_runtime-0.2.89.dist-info → omnata_plugin_runtime-0.2.91.dist-info}/METADATA +1 -1
- {omnata_plugin_runtime-0.2.89.dist-info → omnata_plugin_runtime-0.2.91.dist-info}/RECORD +6 -6
- {omnata_plugin_runtime-0.2.89.dist-info → omnata_plugin_runtime-0.2.91.dist-info}/LICENSE +0 -0
- {omnata_plugin_runtime-0.2.89.dist-info → omnata_plugin_runtime-0.2.91.dist-info}/WHEEL +0 -0
@@ -8,7 +8,7 @@ from typing import Any, List, Dict, Literal, Union, Optional
|
|
8
8
|
from enum import Enum
|
9
9
|
|
10
10
|
from abc import ABC
|
11
|
-
from pydantic import BaseModel, Field # pylint: disable=no-name-in-module
|
11
|
+
from pydantic import BaseModel, Field, validator # pylint: disable=no-name-in-module
|
12
12
|
|
13
13
|
if tuple(sys.version_info[:2]) >= (3, 9):
|
14
14
|
# Python 3.9 and above
|
@@ -530,6 +530,24 @@ class ConnectionConfigurationParameters(SubscriptableBaseModel):
|
|
530
530
|
class Config:
|
531
531
|
underscore_attrs_are_private = True
|
532
532
|
|
533
|
+
@validator("ngrok_tunnel_settings", always=True)
|
534
|
+
def validate_ngrok_tunnel_settings(cls, v: str, values: dict[str, Any]) -> Optional[NgrokTunnelSettings]:
|
535
|
+
"""
|
536
|
+
A validator which picks out the ngrok tunnel configuration from the secrets and provides it as a typed object.
|
537
|
+
"""
|
538
|
+
if "connection_secrets" in values:
|
539
|
+
connection_secrets:Dict[str, StoredConfigurationValue] = values["connection_secrets"]
|
540
|
+
if "ngrok_client_certificate" in connection_secrets and \
|
541
|
+
"ngrok_client_key" in connection_secrets and \
|
542
|
+
"ngrok_endpoint_host" in connection_secrets and \
|
543
|
+
"ngrok_endpoint_port" in connection_secrets:
|
544
|
+
return NgrokTunnelSettings(
|
545
|
+
endpoint_host=connection_secrets["ngrok_endpoint_host"].value,
|
546
|
+
endpoint_port=connection_secrets["ngrok_endpoint_port"].value,
|
547
|
+
client_certificate=connection_secrets["ngrok_client_certificate"].value,
|
548
|
+
client_key=connection_secrets["ngrok_client_key"].value
|
549
|
+
)
|
550
|
+
return None
|
533
551
|
|
534
552
|
def get_connection_parameter(self, parameter_name: str) -> StoredConfigurationValue:
|
535
553
|
"""
|
@@ -21,7 +21,7 @@ from .configuration import (
|
|
21
21
|
StoredConfigurationValue,
|
22
22
|
StoredMappingValue,
|
23
23
|
)
|
24
|
-
from .forms import ConnectionMethod, FormOption
|
24
|
+
from .forms import ConnectionMethod, FormInputField, FormOption
|
25
25
|
from .logging import OmnataPluginLogHandler
|
26
26
|
from .omnata_plugin import (
|
27
27
|
SnowflakeBillingEvent,
|
@@ -403,6 +403,38 @@ class PluginEntrypoint:
|
|
403
403
|
logger.error(f"Error parsing secrets content for secret {other_secrets_name}: {str(exception)}")
|
404
404
|
raise ValueError("Error parsing secrets content:") from exception
|
405
405
|
return connection_secrets
|
406
|
+
|
407
|
+
def ngrok_post_tunnel_fields(
|
408
|
+
self,
|
409
|
+
connection_method: str,
|
410
|
+
connection_parameters: Dict,
|
411
|
+
oauth_secret_name: Optional[str],
|
412
|
+
other_secrets_name: Optional[str],
|
413
|
+
function_name: str,
|
414
|
+
) -> List[FormInputField]:
|
415
|
+
logger.info("Entered ngrok_post_tunnel_fields method")
|
416
|
+
oauth_secret_name = normalise_nulls(oauth_secret_name)
|
417
|
+
other_secrets_name = normalise_nulls(other_secrets_name)
|
418
|
+
connection_secrets = self.get_secrets(oauth_secret_name, other_secrets_name)
|
419
|
+
connection_parameters = parse_obj_as(
|
420
|
+
Dict[str, StoredConfigurationValue], connection_parameters
|
421
|
+
)
|
422
|
+
parameters = ConnectionConfigurationParameters(
|
423
|
+
connection_method=connection_method,
|
424
|
+
connection_parameters=connection_parameters,
|
425
|
+
connection_secrets=connection_secrets
|
426
|
+
)
|
427
|
+
the_function = getattr(
|
428
|
+
self._plugin_instance,
|
429
|
+
function_name,
|
430
|
+
)
|
431
|
+
script_result = the_function(parameters)
|
432
|
+
if isinstance(script_result, List):
|
433
|
+
if len(script_result) > 0 and isinstance(script_result[0], BaseModel):
|
434
|
+
script_result = [r.dict() for r in script_result]
|
435
|
+
else:
|
436
|
+
raise ValueError(f"Expected a List from function {function_name}, got {type(script_result)}")
|
437
|
+
return script_result
|
406
438
|
|
407
439
|
def network_addresses(self, method: str, connection_parameters: Dict) -> List[str]:
|
408
440
|
logger.info("Entered network_addresses method")
|
@@ -1,12 +1,12 @@
|
|
1
1
|
omnata_plugin_runtime/__init__.py,sha256=w63LVME5nY-hQ4BBzfacy9kvTunwqHGs8iiSPGAX2ns,1214
|
2
2
|
omnata_plugin_runtime/api.py,sha256=m8Yqw_lwSjN55ktN2AEgVSL1RYSbGWEvkE-M-GOEXdQ,6149
|
3
|
-
omnata_plugin_runtime/configuration.py,sha256=
|
3
|
+
omnata_plugin_runtime/configuration.py,sha256=oNOGhZjtPihIad631FgOju7UzyT4ZZTYAM2-7fjhZqI,34186
|
4
4
|
omnata_plugin_runtime/forms.py,sha256=uxfYrsVPSDLxfc9SqzjhxkHCTqfBzAl1CM8y-5YRKP0,18372
|
5
5
|
omnata_plugin_runtime/logging.py,sha256=bn7eKoNWvtuyTk7RTwBS9UARMtqkiICtgMtzq3KA2V0,3272
|
6
6
|
omnata_plugin_runtime/omnata_plugin.py,sha256=vFHakGKCmqCLWMp7nn5Q1lL1Pst1KV4_YWUdz_LyYME,86770
|
7
|
-
omnata_plugin_runtime/plugin_entrypoints.py,sha256=
|
7
|
+
omnata_plugin_runtime/plugin_entrypoints.py,sha256=4ASzSL7mRWJ9uSqV31Zy8Oka5OIJI7JowzCX-boJkQc,25811
|
8
8
|
omnata_plugin_runtime/rate_limiting.py,sha256=se6MftQI5NrVHaLb1hByPCgAESPQhkAgIG7KIU1clDU,16562
|
9
|
-
omnata_plugin_runtime-0.2.
|
10
|
-
omnata_plugin_runtime-0.2.
|
11
|
-
omnata_plugin_runtime-0.2.
|
12
|
-
omnata_plugin_runtime-0.2.
|
9
|
+
omnata_plugin_runtime-0.2.91.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
|
10
|
+
omnata_plugin_runtime-0.2.91.dist-info/METADATA,sha256=nvDiuEJRSp6XcCL5562-jYu0FReD1Kk7_nL6c8OdB4A,1086
|
11
|
+
omnata_plugin_runtime-0.2.91.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
12
|
+
omnata_plugin_runtime-0.2.91.dist-info/RECORD,,
|
File without changes
|
File without changes
|