omnata-plugin-runtime 0.7.0a181__py3-none-any.whl → 0.7.0a183__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- omnata_plugin_runtime/api.py +3 -0
- omnata_plugin_runtime/configuration.py +4 -5
- omnata_plugin_runtime/omnata_plugin.py +1 -1
- omnata_plugin_runtime/plugin_entrypoints.py +22 -26
- {omnata_plugin_runtime-0.7.0a181.dist-info → omnata_plugin_runtime-0.7.0a183.dist-info}/METADATA +1 -1
- omnata_plugin_runtime-0.7.0a183.dist-info/RECORD +12 -0
- omnata_plugin_runtime-0.7.0a181.dist-info/RECORD +0 -12
- {omnata_plugin_runtime-0.7.0a181.dist-info → omnata_plugin_runtime-0.7.0a183.dist-info}/LICENSE +0 -0
- {omnata_plugin_runtime-0.7.0a181.dist-info → omnata_plugin_runtime-0.7.0a183.dist-info}/WHEEL +0 -0
omnata_plugin_runtime/api.py
CHANGED
@@ -22,6 +22,7 @@ from .configuration import (
|
|
22
22
|
OutboundSyncStrategy,
|
23
23
|
StoredConfigurationValue,
|
24
24
|
StoredMappingValue,
|
25
|
+
ConnectivityOption
|
25
26
|
)
|
26
27
|
from .rate_limiting import ApiLimits, RateLimitState
|
27
28
|
|
@@ -119,6 +120,7 @@ class OutboundSyncRequestPayload(BaseModel):
|
|
119
120
|
results_table_name: str # used to stage results back to the engine, resides in the main Omnata app database
|
120
121
|
logging_level: str
|
121
122
|
connection_method: str
|
123
|
+
connectivity_option: ConnectivityOption = Field(default=ConnectivityOption.DIRECT)
|
122
124
|
connection_parameters: Dict[str, StoredConfigurationValue]
|
123
125
|
oauth_secret_name: Optional[str] = None
|
124
126
|
other_secrets_name: Optional[str] = None
|
@@ -146,6 +148,7 @@ class InboundSyncRequestPayload(BaseModel):
|
|
146
148
|
results_table_name: str # used to stage results back to the engine, resides in the main Omnata app database
|
147
149
|
logging_level: str
|
148
150
|
connection_method: str
|
151
|
+
connectivity_option: ConnectivityOption = Field(default=ConnectivityOption.DIRECT)
|
149
152
|
connection_parameters: Dict[str, StoredConfigurationValue]
|
150
153
|
oauth_secret_name: Optional[str] = None
|
151
154
|
other_secrets_name: Optional[str] = None
|
@@ -551,6 +551,7 @@ class ConnectionConfigurationParameters(SubscriptableBaseModel):
|
|
551
551
|
"""
|
552
552
|
|
553
553
|
connection_method: str
|
554
|
+
connectivity_option: ConnectivityOption = Field(default=ConnectivityOption.DIRECT)
|
554
555
|
connection_parameters: Optional[Dict[str, StoredConfigurationValue]] = Field(default=None)
|
555
556
|
connection_secrets: Optional[Dict[str, StoredConfigurationValue]] = Field(default=None)
|
556
557
|
ngrok_tunnel_settings: Optional[NgrokTunnelSettings] = Field(default=None)
|
@@ -560,11 +561,9 @@ class ConnectionConfigurationParameters(SubscriptableBaseModel):
|
|
560
561
|
default=None
|
561
562
|
)
|
562
563
|
|
563
|
-
@
|
564
|
-
|
565
|
-
|
566
|
-
A validator which picks out the ngrok tunnel configuration from the secrets and provides it as a typed object.
|
567
|
-
"""
|
564
|
+
@field_validator('ngrok_tunnel_settings',mode='before')
|
565
|
+
@classmethod
|
566
|
+
def validate_ngrok_tunnel_settings(cls, values: Optional[dict[str, Any]]) -> Optional[NgrokTunnelSettings]:
|
568
567
|
if "connection_secrets" in values:
|
569
568
|
connection_secrets:Dict[str, StoredConfigurationValue] = values["connection_secrets"]
|
570
569
|
if "ngrok_client_certificate" in connection_secrets and \
|
@@ -1648,7 +1648,7 @@ class OmnataPlugin(ABC):
|
|
1648
1648
|
)
|
1649
1649
|
|
1650
1650
|
@abstractmethod
|
1651
|
-
def connection_form(self) -> List[ConnectionMethod]:
|
1651
|
+
def connection_form(self,connectivity_option:ConnectivityOption) -> List[ConnectionMethod]:
|
1652
1652
|
"""
|
1653
1653
|
Returns a form definition so that user input can be collected, in order to connect to an app
|
1654
1654
|
|
@@ -20,7 +20,8 @@ from .configuration import (
|
|
20
20
|
OutboundSyncStrategy,
|
21
21
|
StoredConfigurationValue,
|
22
22
|
StoredMappingValue,
|
23
|
-
get_secrets
|
23
|
+
get_secrets,
|
24
|
+
ConnectivityOption
|
24
25
|
)
|
25
26
|
from .forms import ConnectionMethod, FormInputField, FormOption
|
26
27
|
from .logging import OmnataPluginLogHandler
|
@@ -98,6 +99,7 @@ class PluginEntrypoint:
|
|
98
99
|
# construct some connection parameters for the purpose of getting the api limits
|
99
100
|
connection_parameters = ConnectionConfigurationParameters(
|
100
101
|
connection_method=request.connection_method,
|
102
|
+
connectivity_option=request.connectivity_option,
|
101
103
|
connection_parameters=request.connection_parameters,
|
102
104
|
connection_secrets=connection_secrets
|
103
105
|
)
|
@@ -138,6 +140,7 @@ class PluginEntrypoint:
|
|
138
140
|
if request.sync_direction == "outbound":
|
139
141
|
parameters = OutboundSyncConfigurationParameters(
|
140
142
|
connection_method=request.connection_method,
|
143
|
+
connectivity_option=request.connectivity_option,
|
141
144
|
connection_parameters=request.connection_parameters,
|
142
145
|
connection_secrets=connection_secrets,
|
143
146
|
sync_parameters=request.sync_parameters,
|
@@ -193,6 +196,7 @@ class PluginEntrypoint:
|
|
193
196
|
logger.info("Running inbound sync")
|
194
197
|
parameters = InboundSyncConfigurationParameters(
|
195
198
|
connection_method=request.connection_method,
|
199
|
+
connectivity_option=request.connectivity_option,
|
196
200
|
connection_parameters=request.connection_parameters,
|
197
201
|
connection_secrets=connection_secrets,
|
198
202
|
sync_parameters=request.sync_parameters,
|
@@ -268,6 +272,7 @@ class PluginEntrypoint:
|
|
268
272
|
|
269
273
|
def configuration_form(
|
270
274
|
self,
|
275
|
+
connectivity_option:str,
|
271
276
|
connection_method: str,
|
272
277
|
connection_parameters: Dict,
|
273
278
|
oauth_secret_name: Optional[str],
|
@@ -283,6 +288,7 @@ class PluginEntrypoint:
|
|
283
288
|
oauth_secret_name = normalise_nulls(oauth_secret_name)
|
284
289
|
other_secrets_name = normalise_nulls(other_secrets_name)
|
285
290
|
connection_secrets = get_secrets(oauth_secret_name, other_secrets_name)
|
291
|
+
connectivity_option = TypeAdapter(ConnectivityOption).validate_python(connectivity_option)
|
286
292
|
connection_parameters = TypeAdapter(
|
287
293
|
Dict[str, StoredConfigurationValue]).validate_python(connection_parameters)
|
288
294
|
sync_parameters = TypeAdapter(
|
@@ -298,6 +304,7 @@ class PluginEntrypoint:
|
|
298
304
|
sync_strategy=sync_strat,
|
299
305
|
sync_parameters=sync_parameters,
|
300
306
|
connection_method=connection_method,
|
307
|
+
connectivity_option=connectivity_option,
|
301
308
|
current_form_parameters=form_parameters,
|
302
309
|
)
|
303
310
|
elif sync_direction == "inbound":
|
@@ -306,6 +313,7 @@ class PluginEntrypoint:
|
|
306
313
|
connection_secrets=connection_secrets,
|
307
314
|
sync_parameters=sync_parameters,
|
308
315
|
connection_method=connection_method,
|
316
|
+
connectivity_option=connectivity_option,
|
309
317
|
current_form_parameters=form_parameters,
|
310
318
|
)
|
311
319
|
else:
|
@@ -326,6 +334,7 @@ class PluginEntrypoint:
|
|
326
334
|
|
327
335
|
def inbound_list_streams(
|
328
336
|
self,
|
337
|
+
connectivity_option:str,
|
329
338
|
connection_method: str,
|
330
339
|
connection_parameters: Dict,
|
331
340
|
oauth_secret_name: Optional[str],
|
@@ -337,6 +346,7 @@ class PluginEntrypoint:
|
|
337
346
|
oauth_secret_name = normalise_nulls(oauth_secret_name)
|
338
347
|
other_secrets_name = normalise_nulls(other_secrets_name)
|
339
348
|
connection_secrets = get_secrets(oauth_secret_name, other_secrets_name)
|
349
|
+
connectivity_option = TypeAdapter(ConnectivityOption).validate_python(connectivity_option)
|
340
350
|
connection_parameters = TypeAdapter(
|
341
351
|
Dict[str, StoredConfigurationValue]).validate_python(connection_parameters)
|
342
352
|
sync_parameters = TypeAdapter(
|
@@ -345,6 +355,7 @@ class PluginEntrypoint:
|
|
345
355
|
connection_parameters=connection_parameters,
|
346
356
|
connection_secrets=connection_secrets,
|
347
357
|
sync_parameters=sync_parameters,
|
358
|
+
connectivity_option=connectivity_option,
|
348
359
|
connection_method=connection_method,
|
349
360
|
current_form_parameters=None,
|
350
361
|
currently_selected_streams=selected_streams
|
@@ -381,9 +392,10 @@ class PluginEntrypoint:
|
|
381
392
|
results.append(script_result.model_dump())
|
382
393
|
return results
|
383
394
|
|
384
|
-
def connection_form(self):
|
395
|
+
def connection_form(self,connectivity_option: str):
|
396
|
+
connectivity_option = TypeAdapter(ConnectivityOption).validate_python(connectivity_option)
|
385
397
|
logger.info("Entered connection_form method")
|
386
|
-
form: List[ConnectionMethod] = self._plugin_instance.connection_form()
|
398
|
+
form: List[ConnectionMethod] = self._plugin_instance.connection_form(connectivity_option=connectivity_option)
|
387
399
|
return [f.model_dump() for f in form]
|
388
400
|
|
389
401
|
def create_billing_events(self, session, event_request: Dict):
|
@@ -431,30 +443,9 @@ class PluginEntrypoint:
|
|
431
443
|
other_secrets_name: Optional[str],
|
432
444
|
function_name: str,
|
433
445
|
) -> List[FormInputField]:
|
434
|
-
|
435
|
-
oauth_secret_name = normalise_nulls(oauth_secret_name)
|
436
|
-
other_secrets_name = normalise_nulls(other_secrets_name)
|
437
|
-
connection_secrets = get_secrets(oauth_secret_name, other_secrets_name)
|
438
|
-
connection_parameters = TypeAdapter(
|
439
|
-
Dict[str, StoredConfigurationValue]).validate_python(connection_parameters)
|
440
|
-
parameters = ConnectionConfigurationParameters(
|
441
|
-
connection_method=connection_method,
|
442
|
-
connection_parameters=connection_parameters,
|
443
|
-
connection_secrets=connection_secrets
|
444
|
-
)
|
445
|
-
the_function = getattr(
|
446
|
-
self._plugin_instance,
|
447
|
-
function_name,
|
448
|
-
)
|
449
|
-
script_result = the_function(parameters)
|
450
|
-
if isinstance(script_result, List):
|
451
|
-
if len(script_result) > 0 and isinstance(script_result[0], BaseModel):
|
452
|
-
script_result = [r.model_dump() for r in script_result]
|
453
|
-
else:
|
454
|
-
raise ValueError(f"Expected a List from function {function_name}, got {type(script_result)}")
|
455
|
-
return script_result
|
446
|
+
raise ValueError(f"ngrok_post_tunnel_fields is deprecated")
|
456
447
|
|
457
|
-
def network_addresses(self, method: str, connection_parameters: Dict) -> List[str]:
|
448
|
+
def network_addresses(self, connectivity_option:str, method: str, connection_parameters: Dict) -> List[str]:
|
458
449
|
logger.info("Entered network_addresses method")
|
459
450
|
logger.info(f"Connection parameters: {connection_parameters}")
|
460
451
|
from omnata_plugin_runtime.omnata_plugin import (
|
@@ -463,6 +454,7 @@ class PluginEntrypoint:
|
|
463
454
|
|
464
455
|
return self._plugin_instance.network_addresses(
|
465
456
|
ConnectionConfigurationParameters(
|
457
|
+
connectivity_option=TypeAdapter(ConnectivityOption).validate_python(connectivity_option),
|
466
458
|
connection_method=method,
|
467
459
|
connection_parameters=TypeAdapter(
|
468
460
|
Dict[str, StoredConfigurationValue]).validate_python(connection_parameters),
|
@@ -472,6 +464,7 @@ class PluginEntrypoint:
|
|
472
464
|
|
473
465
|
def connect(
|
474
466
|
self,
|
467
|
+
connectivity_option:str,
|
475
468
|
method:str,
|
476
469
|
connection_parameters: Dict,
|
477
470
|
network_rule_name: str,
|
@@ -486,6 +479,7 @@ class PluginEntrypoint:
|
|
486
479
|
ConnectionConfigurationParameters,
|
487
480
|
)
|
488
481
|
parameters = ConnectionConfigurationParameters(
|
482
|
+
connectivity_option=TypeAdapter(ConnectivityOption).validate_python(connectivity_option),
|
489
483
|
connection_method=method,
|
490
484
|
connection_parameters=TypeAdapter(
|
491
485
|
Dict[str, StoredConfigurationValue]).validate_python(connection_parameters),
|
@@ -522,6 +516,7 @@ class PluginEntrypoint:
|
|
522
516
|
return connect_response.model_dump()
|
523
517
|
|
524
518
|
def api_limits(self,
|
519
|
+
connectivity_option:str,
|
525
520
|
method:str,
|
526
521
|
connection_parameters: Dict,
|
527
522
|
oauth_secret_name: Optional[str],
|
@@ -532,6 +527,7 @@ class PluginEntrypoint:
|
|
532
527
|
ConnectionConfigurationParameters,
|
533
528
|
)
|
534
529
|
connection_parameters = ConnectionConfigurationParameters(
|
530
|
+
connectivity_option=TypeAdapter(ConnectivityOption).validate_python(connectivity_option),
|
535
531
|
connection_method=method,
|
536
532
|
connection_parameters=TypeAdapter(
|
537
533
|
Dict[str, StoredConfigurationValue]).validate_python(connection_parameters),
|
@@ -0,0 +1,12 @@
|
|
1
|
+
omnata_plugin_runtime/__init__.py,sha256=MS9d1whnfT_B3-ThqZ7l63QeC_8OEKTuaYV5wTwRpBA,1576
|
2
|
+
omnata_plugin_runtime/api.py,sha256=tVi4KLL0v5N3yz3Ie0kSyFemryu572gCbtSRfWN6wBU,6523
|
3
|
+
omnata_plugin_runtime/configuration.py,sha256=Yyz3trj7G6nh3JyEw6S5qlrXUfS_MB-vZgATcNdWzp0,38339
|
4
|
+
omnata_plugin_runtime/forms.py,sha256=ueodN2GIMS5N9fqebpY4uNGJnjEb9HcuaVQVfWH-cGg,19838
|
5
|
+
omnata_plugin_runtime/logging.py,sha256=bn7eKoNWvtuyTk7RTwBS9UARMtqkiICtgMtzq3KA2V0,3272
|
6
|
+
omnata_plugin_runtime/omnata_plugin.py,sha256=aggjb_CTTjhgqjS8CHPOm4ENU0jNcYoT6LC8yI1IeF4,130048
|
7
|
+
omnata_plugin_runtime/plugin_entrypoints.py,sha256=lbcQVkoYZMFDPOgWUjLhndJ_vCaSle1r6WbrHQ_aDiQ,28782
|
8
|
+
omnata_plugin_runtime/rate_limiting.py,sha256=JukA0l7x7Klqz2b54mR-poP7NRxpUHgWSGp6h0B8u6Q,25612
|
9
|
+
omnata_plugin_runtime-0.7.0a183.dist-info/LICENSE,sha256=rGaMQG3R3F5-JGDp_-rlMKpDIkg5n0SI4kctTk8eZSI,56
|
10
|
+
omnata_plugin_runtime-0.7.0a183.dist-info/METADATA,sha256=cN5DxHRuyg4fB-aeidVywXXHvL1_VRUieJEPrR1w758,1985
|
11
|
+
omnata_plugin_runtime-0.7.0a183.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
12
|
+
omnata_plugin_runtime-0.7.0a183.dist-info/RECORD,,
|
@@ -1,12 +0,0 @@
|
|
1
|
-
omnata_plugin_runtime/__init__.py,sha256=MS9d1whnfT_B3-ThqZ7l63QeC_8OEKTuaYV5wTwRpBA,1576
|
2
|
-
omnata_plugin_runtime/api.py,sha256=FxzTqri4no8ClkOm7vZADG8aD47jcGBCTTQDEORmOJM,6326
|
3
|
-
omnata_plugin_runtime/configuration.py,sha256=hUgh6XNckgf0B8oX1uVz8DaaCbqpnH5chVf_6GlYyHQ,38369
|
4
|
-
omnata_plugin_runtime/forms.py,sha256=ueodN2GIMS5N9fqebpY4uNGJnjEb9HcuaVQVfWH-cGg,19838
|
5
|
-
omnata_plugin_runtime/logging.py,sha256=bn7eKoNWvtuyTk7RTwBS9UARMtqkiICtgMtzq3KA2V0,3272
|
6
|
-
omnata_plugin_runtime/omnata_plugin.py,sha256=zeXiCkhJb9n3G_zJdpi1pwjj-kDFMrXGK67f_Qjfljw,130009
|
7
|
-
omnata_plugin_runtime/plugin_entrypoints.py,sha256=cQRBzNQiKFO088FTzDAyhxp_meJxxuIy1lX8uA0o7FI,28620
|
8
|
-
omnata_plugin_runtime/rate_limiting.py,sha256=JukA0l7x7Klqz2b54mR-poP7NRxpUHgWSGp6h0B8u6Q,25612
|
9
|
-
omnata_plugin_runtime-0.7.0a181.dist-info/LICENSE,sha256=rGaMQG3R3F5-JGDp_-rlMKpDIkg5n0SI4kctTk8eZSI,56
|
10
|
-
omnata_plugin_runtime-0.7.0a181.dist-info/METADATA,sha256=oY9htkkhLkTdgni3MaGw89GDsPcEwc4E5JfMH5L1qUA,1985
|
11
|
-
omnata_plugin_runtime-0.7.0a181.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
12
|
-
omnata_plugin_runtime-0.7.0a181.dist-info/RECORD,,
|
{omnata_plugin_runtime-0.7.0a181.dist-info → omnata_plugin_runtime-0.7.0a183.dist-info}/LICENSE
RENAMED
File without changes
|
{omnata_plugin_runtime-0.7.0a181.dist-info → omnata_plugin_runtime-0.7.0a183.dist-info}/WHEEL
RENAMED
File without changes
|