omnata-plugin-runtime 0.1.74__py3-none-any.whl → 0.1.80__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/api.py +1 -1
- omnata_plugin_runtime/configuration.py +4 -4
- omnata_plugin_runtime/forms.py +17 -3
- omnata_plugin_runtime/omnata_plugin.py +2 -37
- omnata_plugin_runtime/plugin_entrypoints.py +12 -13
- {omnata_plugin_runtime-0.1.74.dist-info → omnata_plugin_runtime-0.1.80.dist-info}/METADATA +2 -2
- omnata_plugin_runtime-0.1.80.dist-info/RECORD +12 -0
- {omnata_plugin_runtime-0.1.74.dist-info → omnata_plugin_runtime-0.1.80.dist-info}/WHEEL +1 -1
- omnata_plugin_runtime-0.1.74.dist-info/RECORD +0 -12
- {omnata_plugin_runtime-0.1.74.dist-info → omnata_plugin_runtime-0.1.80.dist-info}/LICENSE +0 -0
omnata_plugin_runtime/api.py
CHANGED
@@ -115,7 +115,7 @@ class OutboundSyncRequestPayload(BaseModel):
|
|
115
115
|
sync_parameters: Dict[str, StoredConfigurationValue]
|
116
116
|
api_limit_overrides: List[ApiLimits]
|
117
117
|
rate_limits_state: Dict[str, RateLimitState]
|
118
|
-
field_mappings: StoredMappingValue
|
118
|
+
field_mappings: Optional[StoredMappingValue]
|
119
119
|
|
120
120
|
|
121
121
|
class InboundSyncRequestPayload(BaseModel):
|
@@ -205,10 +205,10 @@ class OutboundSyncStrategy(SubscriptableBaseModel, ABC):
|
|
205
205
|
name: str
|
206
206
|
description: str
|
207
207
|
icon_source: str = ICON_URL_CODE
|
208
|
-
action_on_record_create: OutboundSyncAction = None
|
209
|
-
action_on_record_update: OutboundSyncAction = None
|
210
|
-
action_on_record_delete: OutboundSyncAction = None
|
211
|
-
action_on_record_unchanged: OutboundSyncAction = None
|
208
|
+
action_on_record_create: Optional[OutboundSyncAction] = None
|
209
|
+
action_on_record_update: Optional[OutboundSyncAction] = None
|
210
|
+
action_on_record_delete: Optional[OutboundSyncAction] = None
|
211
|
+
action_on_record_unchanged: Optional[OutboundSyncAction] = None
|
212
212
|
custom_strategy: bool = True
|
213
213
|
|
214
214
|
def __eq__(self, other):
|
omnata_plugin_runtime/forms.py
CHANGED
@@ -388,14 +388,28 @@ class InboundSyncConfigurationForm(ConfigurationFormBase):
|
|
388
388
|
fields: List[FormFieldBase] = Field(default_factory=list)
|
389
389
|
stream_lister: StreamLister
|
390
390
|
|
391
|
+
class SecurityIntegrationTemplate(BaseModel):
|
392
|
+
"""
|
393
|
+
Provides values used to populate a security integration instructions template, which
|
394
|
+
in turn allows the customer to create an OAuth based secret object
|
395
|
+
"""
|
396
|
+
oauth_docs_url: Optional[str] = None
|
397
|
+
oauth_type: Literal["code_grant"] = "code_grant"
|
398
|
+
oauth_client_id: str = '<client id>'
|
399
|
+
oauth_client_secret: str = '<client secret>'
|
400
|
+
oauth_token_endpoint: str = '<token endpoint>'
|
401
|
+
oauth_authorization_endpoint: str = '<authorization endpoint>'
|
402
|
+
oauth_allowed_scopes: List[str] = []
|
403
|
+
|
391
404
|
|
392
405
|
class ConnectionMethod(SubscriptableBaseModel):
|
393
406
|
"""
|
394
407
|
Defines a method of connecting to an application.
|
395
408
|
:param str data_source: The name of the connection method, e.g. "OAuth", "API Key", "Credentials"
|
396
409
|
:param List[FormFieldBase] fields: A list of fields that are used to collect the connection information from the user.
|
397
|
-
:param
|
398
|
-
|
410
|
+
:param Optional[SecurityIntegrationTemplate] oauth_template: If provided, the user will be guided through the process
|
411
|
+
of creating a security integration, followed by a secret and performing the OAuth flow. Once this secret is completed,
|
412
|
+
the rest of the values from the form will be captured and then the connection will be tested.
|
399
413
|
:param str description: A markdown description of the connection method, which will be displayed to the user.
|
400
414
|
This should be concise as it will be displayed in a sidebar, but you can include a link to the connection section
|
401
415
|
of the plugin's documentation.
|
@@ -403,5 +417,5 @@ class ConnectionMethod(SubscriptableBaseModel):
|
|
403
417
|
|
404
418
|
name: str
|
405
419
|
fields: List[FormFieldBase]
|
406
|
-
|
420
|
+
oauth_template: Optional[SecurityIntegrationTemplate] = None
|
407
421
|
description: str = ""
|
@@ -1038,23 +1038,6 @@ class InboundSyncRequest(SyncRequest):
|
|
1038
1038
|
self._plugin_message(PluginMessageStreamState(stream_state=self._latest_states))
|
1039
1039
|
|
1040
1040
|
|
1041
|
-
class OAuthParameters(SubscriptableBaseModel):
|
1042
|
-
"""
|
1043
|
-
Encapsulates a set of OAuth Parameters
|
1044
|
-
"""
|
1045
|
-
|
1046
|
-
scope: str
|
1047
|
-
authorization_url: str
|
1048
|
-
access_token_url: str
|
1049
|
-
client_id: str
|
1050
|
-
state: Optional[str] = None
|
1051
|
-
response_type: str = "code"
|
1052
|
-
access_type: str = "offline"
|
1053
|
-
|
1054
|
-
class Config:
|
1055
|
-
extra = "allow" # OAuth can contain extra fields
|
1056
|
-
|
1057
|
-
|
1058
1041
|
class ConnectResponse(SubscriptableBaseModel):
|
1059
1042
|
"""
|
1060
1043
|
Encapsulates the response to a connection request. This is used to pass back any additional
|
@@ -1085,14 +1068,11 @@ class BillingEvent(BaseModel):
|
|
1085
1068
|
class BillingEventRequest(BaseModel):
|
1086
1069
|
"""
|
1087
1070
|
Represents a request to provide billing events for that day.
|
1088
|
-
The Omnata engine provides the number of runs for the most frequent inbound and outbound syncs, and the sync ids
|
1089
1071
|
"""
|
1090
1072
|
|
1091
1073
|
billing_schedule: Literal["DAILY"]
|
1092
|
-
|
1093
|
-
|
1094
|
-
outbound_most_frequent_run_count: int
|
1095
|
-
outbound_most_frequent_sync_id: int
|
1074
|
+
has_active_inbound: bool
|
1075
|
+
has_active_outbound: bool
|
1096
1076
|
|
1097
1077
|
|
1098
1078
|
# BillingEventRequest = Annotated[Union[DailyBillingEventRequest,...],Field(discriminator='billing_schedule')]
|
@@ -1193,21 +1173,6 @@ class OmnataPlugin(ABC):
|
|
1193
1173
|
"""
|
1194
1174
|
raise NotImplementedError("Your plugin class must implement the connect method")
|
1195
1175
|
|
1196
|
-
def oauth_parameters(
|
1197
|
-
self, parameters: ConnectionConfigurationParameters
|
1198
|
-
) -> OAuthParameters:
|
1199
|
-
"""
|
1200
|
-
This function is called for any connection method where the "oauth" flag is set to true.
|
1201
|
-
Connection Parameters are provided in case they are needed to construct the OAuth parameters.
|
1202
|
-
|
1203
|
-
:param PluginConfigurationParameters parameters the parameters of the sync, as configured by the user
|
1204
|
-
:return A OAuthParameters, which contains information to commence an OAuth flow
|
1205
|
-
:rtype OAuthParameters
|
1206
|
-
"""
|
1207
|
-
raise NotImplementedError(
|
1208
|
-
"Your plugin class must implement the oauth_parameters method"
|
1209
|
-
)
|
1210
|
-
|
1211
1176
|
def sync_outbound(
|
1212
1177
|
self,
|
1213
1178
|
parameters: OutboundSyncConfigurationParameters,
|
@@ -317,11 +317,11 @@ class PluginEntrypoint:
|
|
317
317
|
events: List[BillingEvent] = self._plugin_instance.create_billing_events(
|
318
318
|
request
|
319
319
|
)
|
320
|
-
# create each billing event, waiting a
|
320
|
+
# create each billing event, waiting a second between each one
|
321
321
|
first_time = True
|
322
322
|
for billing_event in events:
|
323
323
|
if not first_time:
|
324
|
-
time.sleep(
|
324
|
+
time.sleep(1)
|
325
325
|
else:
|
326
326
|
first_time = False
|
327
327
|
current_time = int(time.time() * 1000)
|
@@ -341,8 +341,8 @@ class PluginEntrypoint:
|
|
341
341
|
$${json.dumps(billing_event.additional_info)}$$)
|
342
342
|
"""
|
343
343
|
logger.info(f"Executing billing event query: {event_query}")
|
344
|
-
|
345
|
-
|
344
|
+
result = session.sql(event_query).collect()
|
345
|
+
logger.info(f"Billing event result: {result}")
|
346
346
|
return [e.dict() for e in events]
|
347
347
|
|
348
348
|
def get_secrets(
|
@@ -361,14 +361,15 @@ class PluginEntrypoint:
|
|
361
361
|
secret_string_content = _snowflake.get_generic_secret_string(
|
362
362
|
other_secrets_name
|
363
363
|
)
|
364
|
-
|
364
|
+
if len(secret_string_content) > 2:
|
365
|
+
other_secrets = json.loads(secret_string_content)
|
366
|
+
connection_secrets = {
|
367
|
+
**connection_secrets,
|
368
|
+
**parse_obj_as(Dict[str, StoredConfigurationValue], other_secrets),
|
369
|
+
}
|
365
370
|
except Exception as exception:
|
366
|
-
logger.error(f"Error parsing secrets content: {str(exception)}")
|
371
|
+
logger.error(f"Error parsing secrets content for secret {other_secrets_name}: {str(exception)}")
|
367
372
|
raise ValueError("Error parsing secrets content:") from exception
|
368
|
-
connection_secrets = {
|
369
|
-
**connection_secrets,
|
370
|
-
**parse_obj_as(Dict[str, StoredConfigurationValue], other_secrets),
|
371
|
-
}
|
372
373
|
return connection_secrets
|
373
374
|
|
374
375
|
def network_addresses(self, method: str, connection_parameters: Dict) -> List[str]:
|
@@ -410,9 +411,7 @@ class PluginEntrypoint:
|
|
410
411
|
connection_parameters=parse_obj_as(
|
411
412
|
Dict[str, StoredConfigurationValue], connection_parameters
|
412
413
|
),
|
413
|
-
connection_secrets=
|
414
|
-
Dict[str, StoredConfigurationValue], connection_secrets
|
415
|
-
),
|
414
|
+
connection_secrets=connection_secrets
|
416
415
|
)
|
417
416
|
)
|
418
417
|
# the connect method can also return more network addresses. If so, we need to update the
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: omnata-plugin-runtime
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.80
|
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
|
@@ -11,7 +11,7 @@ Requires-Dist: jinja2 (>=3,<4)
|
|
11
11
|
Requires-Dist: pandas
|
12
12
|
Requires-Dist: pydantic (>=1,<2)
|
13
13
|
Requires-Dist: requests (>=2,<3)
|
14
|
-
Requires-Dist: snowflake-snowpark-python (>=1
|
14
|
+
Requires-Dist: snowflake-snowpark-python (>=1,<2)
|
15
15
|
Description-Content-Type: text/markdown
|
16
16
|
|
17
17
|
# omnata-plugin-runtime
|
@@ -0,0 +1,12 @@
|
|
1
|
+
omnata_plugin_runtime/__init__.py,sha256=w63LVME5nY-hQ4BBzfacy9kvTunwqHGs8iiSPGAX2ns,1214
|
2
|
+
omnata_plugin_runtime/api.py,sha256=vCDTCxPZ5rIhi8aSM6Z0TXWHtGpbCoNvCnM3mKa-47Q,5591
|
3
|
+
omnata_plugin_runtime/configuration.py,sha256=7P1g8ryOqiXULhKnosAp_uS-h4bZP7i0VZOQ3Izmsac,29513
|
4
|
+
omnata_plugin_runtime/forms.py,sha256=AEj74Wko89zBSgucVfPRctU-MI-AuYsIOEBDPhDi6Hc,15050
|
5
|
+
omnata_plugin_runtime/logging.py,sha256=ne1sLh5cBkjdRS54B30PGc5frABgjy0sF1_2RMcJ_Tk,3012
|
6
|
+
omnata_plugin_runtime/omnata_plugin.py,sha256=LLn4o8xZHXFpdfhIgUiC-eIbvhZOGfhNeqZVsjRQxB8,74217
|
7
|
+
omnata_plugin_runtime/plugin_entrypoints.py,sha256=RyOtV2OZ1gRmlXJKpg7EwyWaUK_5oNAGDymXgInMnck,21267
|
8
|
+
omnata_plugin_runtime/rate_limiting.py,sha256=OnFnCdMenpMpAZYumpe6mypRnMmDl1Q02vzlgmQgiw0,10733
|
9
|
+
omnata_plugin_runtime-0.1.80.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
|
10
|
+
omnata_plugin_runtime-0.1.80.dist-info/METADATA,sha256=eIByiBLYOznPEF_zymN5f7q7UQpNRQAqSRzld1zyIsI,987
|
11
|
+
omnata_plugin_runtime-0.1.80.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
12
|
+
omnata_plugin_runtime-0.1.80.dist-info/RECORD,,
|
@@ -1,12 +0,0 @@
|
|
1
|
-
omnata_plugin_runtime/__init__.py,sha256=w63LVME5nY-hQ4BBzfacy9kvTunwqHGs8iiSPGAX2ns,1214
|
2
|
-
omnata_plugin_runtime/api.py,sha256=Zv6L1-NNtlF7L5rkiU2L__RPwKDDxMVeYPm03dCzKCo,5581
|
3
|
-
omnata_plugin_runtime/configuration.py,sha256=4wdKiIDvNzvUZLyv5dn6tNT_JhqI1xVg4p8GYo46680,29473
|
4
|
-
omnata_plugin_runtime/forms.py,sha256=AIKMcMxsh42nVYb2Jg51bh_AekMkZPvlChsAqZyLdg4,14302
|
5
|
-
omnata_plugin_runtime/logging.py,sha256=ne1sLh5cBkjdRS54B30PGc5frABgjy0sF1_2RMcJ_Tk,3012
|
6
|
-
omnata_plugin_runtime/omnata_plugin.py,sha256=UkA06vpUClw1xMnMWDYpxrqerD406Ih8bmatX4HKYPA,75493
|
7
|
-
omnata_plugin_runtime/plugin_entrypoints.py,sha256=U4Yitsp0aAiByz0D7ITF5RH_ntJYV0Qkgy5Dlg3dSsc,21192
|
8
|
-
omnata_plugin_runtime/rate_limiting.py,sha256=OnFnCdMenpMpAZYumpe6mypRnMmDl1Q02vzlgmQgiw0,10733
|
9
|
-
omnata_plugin_runtime-0.1.74.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
|
10
|
-
omnata_plugin_runtime-0.1.74.dist-info/METADATA,sha256=TYeCn4OHoS1SgbpaQoAivIxKVBzf0049tFScNjN5vUo,995
|
11
|
-
omnata_plugin_runtime-0.1.74.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
12
|
-
omnata_plugin_runtime-0.1.74.dist-info/RECORD,,
|
File without changes
|