omnata-plugin-runtime 0.1.0__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/__init__.py +39 -0
- omnata_plugin_runtime/api.py +73 -0
- omnata_plugin_runtime/configuration.py +593 -0
- omnata_plugin_runtime/forms.py +306 -0
- omnata_plugin_runtime/logging.py +91 -0
- omnata_plugin_runtime/omnata_plugin.py +1154 -0
- omnata_plugin_runtime/plugin_entrypoints.py +286 -0
- omnata_plugin_runtime/rate_limiting.py +232 -0
- omnata_plugin_runtime/record_transformer.py +50 -0
- omnata_plugin_runtime-0.1.0.dist-info/LICENSE +504 -0
- omnata_plugin_runtime-0.1.0.dist-info/METADATA +28 -0
- omnata_plugin_runtime-0.1.0.dist-info/RECORD +13 -0
- omnata_plugin_runtime-0.1.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
r"""
|
2
|
+
# Omnata Plugin Runtime
|
3
|
+
|
4
|
+
This runtime provides a Python-based plugin system for Omnata.
|
5
|
+
|
6
|
+
The runtime is kept separate from the Devkit in order to keep runtime dependencies to a minimum.
|
7
|
+
|
8
|
+
It contains several submodules:
|
9
|
+
|
10
|
+
## api
|
11
|
+
|
12
|
+
Used internally for the interface between the plugin and the Omnata engine. Not intended for use by plugin developers.
|
13
|
+
|
14
|
+
## configuration
|
15
|
+
|
16
|
+
Data classes used by the configuration process
|
17
|
+
|
18
|
+
## forms
|
19
|
+
|
20
|
+
Containers for form elements, used by the Omnata UI to render configuration forms during connection and sync setup.
|
21
|
+
|
22
|
+
## omnata_plugin
|
23
|
+
|
24
|
+
The main plugin engine, contains the OmnataPlugin class which is subclassed when creating a plugin, as well as
|
25
|
+
related classes for handling requests and responses.
|
26
|
+
|
27
|
+
## rate_limiting
|
28
|
+
|
29
|
+
Functionality for rate limiting API calls to remote systems.
|
30
|
+
|
31
|
+
## record_transformer
|
32
|
+
|
33
|
+
Record transformation functionality. Source records are transformed during each sync run in order to check for differences.
|
34
|
+
This is a lightweight operation achieved via User-Defined-Functions, so record transformers are kept separate from the
|
35
|
+
plugin code to further minimise dependancies.
|
36
|
+
|
37
|
+
"""
|
38
|
+
|
39
|
+
__docformat__ = "markdown" # explicitly disable rST processing in the examples above.
|
@@ -0,0 +1,73 @@
|
|
1
|
+
import sys
|
2
|
+
if tuple(sys.version_info[:2]) >= (3, 9):
|
3
|
+
# Python 3.9 and above
|
4
|
+
from typing import Annotated
|
5
|
+
else:
|
6
|
+
# Python 3.8 and below
|
7
|
+
from typing_extensions import Annotated
|
8
|
+
|
9
|
+
from pydantic import BaseModel,Field # pylint: disable=no-name-in-module
|
10
|
+
from typing import Optional, Dict, List, Literal, Union
|
11
|
+
from .rate_limiting import ApiLimits, RateLimitState
|
12
|
+
from .configuration import InboundSyncStreamsConfiguration, OutboundSyncStrategy, StoredConfigurationValue, StoredFieldMappings
|
13
|
+
from .omnata_plugin import PluginManifest
|
14
|
+
|
15
|
+
class OutboundApplyPayload(BaseModel):
|
16
|
+
"""
|
17
|
+
Encapsulates the payload that is sent to the plugin when it is invoked to perform an outbound sync.
|
18
|
+
"""
|
19
|
+
sync_id:int # only used by log handler
|
20
|
+
sync_branch_id:Optional[int] # only used by log handler
|
21
|
+
connection_id:int # only used by log handler
|
22
|
+
run_id:int # used by log handler and for reporting back run status updates
|
23
|
+
source_app_name:str # the name of the app which is invoking this plugin
|
24
|
+
results_schema_name:str # the name of the schema where the results table resides
|
25
|
+
results_table_name:str # used to stage results back to the engine, resides in the main Omnata app database
|
26
|
+
logging_level:str
|
27
|
+
connection_method:str
|
28
|
+
connection_parameters:Dict[str,StoredConfigurationValue]
|
29
|
+
oauth_secret_name:Optional[str]
|
30
|
+
other_secrets_name:Optional[str]
|
31
|
+
sync_direction:Literal["outbound"] = 'outbound'
|
32
|
+
sync_strategy:OutboundSyncStrategy
|
33
|
+
sync_parameters:Dict[str,StoredConfigurationValue]
|
34
|
+
api_limit_overrides:List[ApiLimits]
|
35
|
+
rate_limits_state:Dict[str, RateLimitState]
|
36
|
+
field_mappings:StoredFieldMappings
|
37
|
+
|
38
|
+
class InboundApplyPayload(BaseModel):
|
39
|
+
"""
|
40
|
+
Encapsulates the payload that is sent to the plugin when it is invoked to perform an inbound sync.
|
41
|
+
"""
|
42
|
+
sync_id:int # only used by log handler
|
43
|
+
sync_branch_id:Optional[int] # only used by log handler
|
44
|
+
connection_id:int # only used by log handler
|
45
|
+
run_id:int # used by log handler and for reporting back run status updates
|
46
|
+
source_app_name:str # the name of the app which is invoking this plugin
|
47
|
+
results_schema_name:str # the name of the schema where the results table resides
|
48
|
+
results_table_name:str # used to stage results back to the engine, resides in the main Omnata app database
|
49
|
+
logging_level:str
|
50
|
+
connection_method:str
|
51
|
+
connection_parameters:Dict[str,StoredConfigurationValue]
|
52
|
+
oauth_secret_name:Optional[str]
|
53
|
+
other_secrets_name:Optional[str]
|
54
|
+
sync_direction:Literal["inbound"] = 'inbound'
|
55
|
+
sync_parameters:Dict[str,StoredConfigurationValue]
|
56
|
+
api_limit_overrides:List[ApiLimits]
|
57
|
+
rate_limits_state:Dict[str, RateLimitState]
|
58
|
+
streams_configuration:InboundSyncStreamsConfiguration
|
59
|
+
latest_stream_state:Dict
|
60
|
+
|
61
|
+
ApplyPayload = Annotated[Union[OutboundApplyPayload,InboundApplyPayload],Field(discriminator='sync_direction')]
|
62
|
+
|
63
|
+
class PluginInfo(BaseModel):
|
64
|
+
"""
|
65
|
+
Manifest plus other derived information about a plugin which is determined during upload.
|
66
|
+
"""
|
67
|
+
manifest: PluginManifest
|
68
|
+
anaconda_packages:List[str]
|
69
|
+
bundled_packages:List[str]
|
70
|
+
icon_source: Optional[str]
|
71
|
+
plugin_class_name: str
|
72
|
+
transformer_class_name: Optional[str]
|
73
|
+
package_source: Literal['function','stage']
|