omnata-plugin-runtime 0.7.0a182__py3-none-any.whl → 0.7.0a184__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.
@@ -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
- @validator("ngrok_tunnel_settings", always=True)
564
- def validate_ngrok_tunnel_settings(cls, v: str, values: dict[str, Any]) -> Optional[NgrokTunnelSettings]:
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 \
@@ -99,6 +99,7 @@ class PluginEntrypoint:
99
99
  # construct some connection parameters for the purpose of getting the api limits
100
100
  connection_parameters = ConnectionConfigurationParameters(
101
101
  connection_method=request.connection_method,
102
+ connectivity_option=request.connectivity_option,
102
103
  connection_parameters=request.connection_parameters,
103
104
  connection_secrets=connection_secrets
104
105
  )
@@ -139,6 +140,7 @@ class PluginEntrypoint:
139
140
  if request.sync_direction == "outbound":
140
141
  parameters = OutboundSyncConfigurationParameters(
141
142
  connection_method=request.connection_method,
143
+ connectivity_option=request.connectivity_option,
142
144
  connection_parameters=request.connection_parameters,
143
145
  connection_secrets=connection_secrets,
144
146
  sync_parameters=request.sync_parameters,
@@ -194,6 +196,7 @@ class PluginEntrypoint:
194
196
  logger.info("Running inbound sync")
195
197
  parameters = InboundSyncConfigurationParameters(
196
198
  connection_method=request.connection_method,
199
+ connectivity_option=request.connectivity_option,
197
200
  connection_parameters=request.connection_parameters,
198
201
  connection_secrets=connection_secrets,
199
202
  sync_parameters=request.sync_parameters,
@@ -269,6 +272,7 @@ class PluginEntrypoint:
269
272
 
270
273
  def configuration_form(
271
274
  self,
275
+ connectivity_option:str,
272
276
  connection_method: str,
273
277
  connection_parameters: Dict,
274
278
  oauth_secret_name: Optional[str],
@@ -284,6 +288,7 @@ class PluginEntrypoint:
284
288
  oauth_secret_name = normalise_nulls(oauth_secret_name)
285
289
  other_secrets_name = normalise_nulls(other_secrets_name)
286
290
  connection_secrets = get_secrets(oauth_secret_name, other_secrets_name)
291
+ connectivity_option = TypeAdapter(ConnectivityOption).validate_python(connectivity_option)
287
292
  connection_parameters = TypeAdapter(
288
293
  Dict[str, StoredConfigurationValue]).validate_python(connection_parameters)
289
294
  sync_parameters = TypeAdapter(
@@ -299,6 +304,7 @@ class PluginEntrypoint:
299
304
  sync_strategy=sync_strat,
300
305
  sync_parameters=sync_parameters,
301
306
  connection_method=connection_method,
307
+ connectivity_option=connectivity_option,
302
308
  current_form_parameters=form_parameters,
303
309
  )
304
310
  elif sync_direction == "inbound":
@@ -307,6 +313,7 @@ class PluginEntrypoint:
307
313
  connection_secrets=connection_secrets,
308
314
  sync_parameters=sync_parameters,
309
315
  connection_method=connection_method,
316
+ connectivity_option=connectivity_option,
310
317
  current_form_parameters=form_parameters,
311
318
  )
312
319
  else:
@@ -327,6 +334,7 @@ class PluginEntrypoint:
327
334
 
328
335
  def inbound_list_streams(
329
336
  self,
337
+ connectivity_option:str,
330
338
  connection_method: str,
331
339
  connection_parameters: Dict,
332
340
  oauth_secret_name: Optional[str],
@@ -338,6 +346,7 @@ class PluginEntrypoint:
338
346
  oauth_secret_name = normalise_nulls(oauth_secret_name)
339
347
  other_secrets_name = normalise_nulls(other_secrets_name)
340
348
  connection_secrets = get_secrets(oauth_secret_name, other_secrets_name)
349
+ connectivity_option = TypeAdapter(ConnectivityOption).validate_python(connectivity_option)
341
350
  connection_parameters = TypeAdapter(
342
351
  Dict[str, StoredConfigurationValue]).validate_python(connection_parameters)
343
352
  sync_parameters = TypeAdapter(
@@ -346,6 +355,7 @@ class PluginEntrypoint:
346
355
  connection_parameters=connection_parameters,
347
356
  connection_secrets=connection_secrets,
348
357
  sync_parameters=sync_parameters,
358
+ connectivity_option=connectivity_option,
349
359
  connection_method=connection_method,
350
360
  current_form_parameters=None,
351
361
  currently_selected_streams=selected_streams
@@ -385,7 +395,10 @@ class PluginEntrypoint:
385
395
  def connection_form(self,connectivity_option: str):
386
396
  connectivity_option = TypeAdapter(ConnectivityOption).validate_python(connectivity_option)
387
397
  logger.info("Entered connection_form method")
388
- form: List[ConnectionMethod] = self._plugin_instance.connection_form(connectivity_option=connectivity_option)
398
+ if self._plugin_instance.connection_form.connection_form.__code__.co_argcount==1:
399
+ form: List[ConnectionMethod] = self._plugin_instance.connection_form()
400
+ else:
401
+ form: List[ConnectionMethod] = self._plugin_instance.connection_form(connectivity_option)
389
402
  return [f.model_dump() for f in form]
390
403
 
391
404
  def create_billing_events(self, session, event_request: Dict):
@@ -433,30 +446,9 @@ class PluginEntrypoint:
433
446
  other_secrets_name: Optional[str],
434
447
  function_name: str,
435
448
  ) -> List[FormInputField]:
436
- logger.info("Entered ngrok_post_tunnel_fields method")
437
- oauth_secret_name = normalise_nulls(oauth_secret_name)
438
- other_secrets_name = normalise_nulls(other_secrets_name)
439
- connection_secrets = get_secrets(oauth_secret_name, other_secrets_name)
440
- connection_parameters = TypeAdapter(
441
- Dict[str, StoredConfigurationValue]).validate_python(connection_parameters)
442
- parameters = ConnectionConfigurationParameters(
443
- connection_method=connection_method,
444
- connection_parameters=connection_parameters,
445
- connection_secrets=connection_secrets
446
- )
447
- the_function = getattr(
448
- self._plugin_instance,
449
- function_name,
450
- )
451
- script_result = the_function(parameters)
452
- if isinstance(script_result, List):
453
- if len(script_result) > 0 and isinstance(script_result[0], BaseModel):
454
- script_result = [r.model_dump() for r in script_result]
455
- else:
456
- raise ValueError(f"Expected a List from function {function_name}, got {type(script_result)}")
457
- return script_result
449
+ raise ValueError(f"ngrok_post_tunnel_fields is deprecated")
458
450
 
459
- def network_addresses(self, method: str, connection_parameters: Dict) -> List[str]:
451
+ def network_addresses(self, connectivity_option:str, method: str, connection_parameters: Dict) -> List[str]:
460
452
  logger.info("Entered network_addresses method")
461
453
  logger.info(f"Connection parameters: {connection_parameters}")
462
454
  from omnata_plugin_runtime.omnata_plugin import (
@@ -465,6 +457,7 @@ class PluginEntrypoint:
465
457
 
466
458
  return self._plugin_instance.network_addresses(
467
459
  ConnectionConfigurationParameters(
460
+ connectivity_option=TypeAdapter(ConnectivityOption).validate_python(connectivity_option),
468
461
  connection_method=method,
469
462
  connection_parameters=TypeAdapter(
470
463
  Dict[str, StoredConfigurationValue]).validate_python(connection_parameters),
@@ -474,6 +467,7 @@ class PluginEntrypoint:
474
467
 
475
468
  def connect(
476
469
  self,
470
+ connectivity_option:str,
477
471
  method:str,
478
472
  connection_parameters: Dict,
479
473
  network_rule_name: str,
@@ -488,6 +482,7 @@ class PluginEntrypoint:
488
482
  ConnectionConfigurationParameters,
489
483
  )
490
484
  parameters = ConnectionConfigurationParameters(
485
+ connectivity_option=TypeAdapter(ConnectivityOption).validate_python(connectivity_option),
491
486
  connection_method=method,
492
487
  connection_parameters=TypeAdapter(
493
488
  Dict[str, StoredConfigurationValue]).validate_python(connection_parameters),
@@ -524,6 +519,7 @@ class PluginEntrypoint:
524
519
  return connect_response.model_dump()
525
520
 
526
521
  def api_limits(self,
522
+ connectivity_option:str,
527
523
  method:str,
528
524
  connection_parameters: Dict,
529
525
  oauth_secret_name: Optional[str],
@@ -534,6 +530,7 @@ class PluginEntrypoint:
534
530
  ConnectionConfigurationParameters,
535
531
  )
536
532
  connection_parameters = ConnectionConfigurationParameters(
533
+ connectivity_option=TypeAdapter(ConnectivityOption).validate_python(connectivity_option),
537
534
  connection_method=method,
538
535
  connection_parameters=TypeAdapter(
539
536
  Dict[str, StoredConfigurationValue]).validate_python(connection_parameters),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.7.0a182
3
+ Version: 0.7.0a184
4
4
  Summary: Classes and common runtime components for building and running Omnata Plugins
5
5
  Author: James Weakley
6
6
  Author-email: james.weakley@omnata.com
@@ -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=Ulu4udC4tfCH-EA3VGXAT_WKHw5yZ6_ulsL7SjAN0qo,28953
8
+ omnata_plugin_runtime/rate_limiting.py,sha256=JukA0l7x7Klqz2b54mR-poP7NRxpUHgWSGp6h0B8u6Q,25612
9
+ omnata_plugin_runtime-0.7.0a184.dist-info/LICENSE,sha256=rGaMQG3R3F5-JGDp_-rlMKpDIkg5n0SI4kctTk8eZSI,56
10
+ omnata_plugin_runtime-0.7.0a184.dist-info/METADATA,sha256=CsI5s6i4uyWKk2g6aUHbSHq9WXkclnRVQL3rDQ7rY4s,1985
11
+ omnata_plugin_runtime-0.7.0a184.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
12
+ omnata_plugin_runtime-0.7.0a184.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=aggjb_CTTjhgqjS8CHPOm4ENU0jNcYoT6LC8yI1IeF4,130048
7
- omnata_plugin_runtime/plugin_entrypoints.py,sha256=lPy1YcbpU2wF3toj863i2TavNmNbhtNNWAgY2s0FKwc,28807
8
- omnata_plugin_runtime/rate_limiting.py,sha256=JukA0l7x7Klqz2b54mR-poP7NRxpUHgWSGp6h0B8u6Q,25612
9
- omnata_plugin_runtime-0.7.0a182.dist-info/LICENSE,sha256=rGaMQG3R3F5-JGDp_-rlMKpDIkg5n0SI4kctTk8eZSI,56
10
- omnata_plugin_runtime-0.7.0a182.dist-info/METADATA,sha256=pL4Ip9lgrpc4x_lcJvNHRvlvSpWbm-naa3QcI2x03Ao,1985
11
- omnata_plugin_runtime-0.7.0a182.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
12
- omnata_plugin_runtime-0.7.0a182.dist-info/RECORD,,