omnata-plugin-runtime 0.3.8__py3-none-any.whl → 0.3.9__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/omnata_plugin.py +35 -6
- omnata_plugin_runtime/plugin_entrypoints.py +2 -2
- {omnata_plugin_runtime-0.3.8.dist-info → omnata_plugin_runtime-0.3.9.dist-info}/METADATA +1 -1
- {omnata_plugin_runtime-0.3.8.dist-info → omnata_plugin_runtime-0.3.9.dist-info}/RECORD +6 -6
- {omnata_plugin_runtime-0.3.8.dist-info → omnata_plugin_runtime-0.3.9.dist-info}/WHEEL +1 -1
- {omnata_plugin_runtime-0.3.8.dist-info → omnata_plugin_runtime-0.3.9.dist-info}/LICENSE +0 -0
@@ -4,6 +4,15 @@ Omnata Plugin Runtime.
|
|
4
4
|
Includes data container classes and defines the contract for a plugin.
|
5
5
|
"""
|
6
6
|
from __future__ import annotations
|
7
|
+
import sys
|
8
|
+
from typing import Union
|
9
|
+
if tuple(sys.version_info[:2]) >= (3, 9):
|
10
|
+
# Python 3.9 and above
|
11
|
+
from typing import Annotated # pylint: disable=ungrouped-imports
|
12
|
+
else:
|
13
|
+
# Python 3.8 and below
|
14
|
+
from typing_extensions import Annotated
|
15
|
+
|
7
16
|
|
8
17
|
import datetime
|
9
18
|
import http
|
@@ -20,7 +29,7 @@ import jinja2
|
|
20
29
|
import pandas
|
21
30
|
import pydantic
|
22
31
|
import pydantic.json
|
23
|
-
from pydantic import parse_obj_as, root_validator
|
32
|
+
from pydantic import Field, parse_obj_as, root_validator
|
24
33
|
from dateutil.parser import parse
|
25
34
|
from jinja2 import Environment
|
26
35
|
from pydantic import BaseModel # pylint: disable=no-name-in-module
|
@@ -1208,17 +1217,37 @@ class SnowflakeBillingEvent(BaseModel):
|
|
1208
1217
|
raise ValueError("start_timestamp must be timezone aware")
|
1209
1218
|
return values
|
1210
1219
|
|
1211
|
-
class
|
1220
|
+
class DailyBillingEventRequest(BaseModel):
|
1212
1221
|
"""
|
1213
1222
|
Represents a request to provide billing events for that day.
|
1223
|
+
These will occur at midnight, and cover the previous 24 hours.
|
1224
|
+
Provides enough information for the plugin to create billing events for the day.
|
1225
|
+
"""
|
1226
|
+
|
1227
|
+
billing_schedule: Literal["DAILY"] = "DAILY"
|
1228
|
+
billable_connections_inbound: int = 0
|
1229
|
+
billable_connections_outbound: int = 0
|
1230
|
+
# below is deprecated
|
1231
|
+
has_active_inbound: bool = False
|
1232
|
+
has_active_outbound: bool = False
|
1233
|
+
|
1234
|
+
class MonthlyBillingEventRequest(BaseModel):
|
1235
|
+
"""
|
1236
|
+
Represents a request to provide billing events for that month.
|
1237
|
+
These will occur at midnight on the first of each month, and cover the whole previous month.
|
1238
|
+
Currently, these exist to provide a way to bill for the number of active ngrok connections
|
1239
|
+
and associated data overages.
|
1214
1240
|
"""
|
1215
1241
|
|
1216
|
-
billing_schedule: Literal["
|
1217
|
-
|
1218
|
-
|
1242
|
+
billing_schedule: Literal["MONTHLY"] = "MONTHLY"
|
1243
|
+
distinct_active_ngrok_connections: int = 0
|
1244
|
+
ngrok_data_usage_bytes: int = 0
|
1245
|
+
# below is deprecated
|
1246
|
+
has_active_inbound: bool = False
|
1247
|
+
has_active_outbound: bool = False
|
1219
1248
|
|
1220
1249
|
|
1221
|
-
|
1250
|
+
BillingEventRequest = Annotated[Union[DailyBillingEventRequest,MonthlyBillingEventRequest],Field(discriminator='billing_schedule')]
|
1222
1251
|
|
1223
1252
|
|
1224
1253
|
class OmnataPlugin(ABC):
|
@@ -392,7 +392,7 @@ class PluginEntrypoint:
|
|
392
392
|
result = session.sql(event_query).collect()
|
393
393
|
logger.info(f"Billing event result: {result}")
|
394
394
|
except Exception as e:
|
395
|
-
if '370001:3159209004' in str(e):
|
395
|
+
if '370001:3159209004' in str(e) or 'Application instance is not installed from listing' in str(e):
|
396
396
|
logger.warn('Billing event creation failed due to running internally to Omnata')
|
397
397
|
else:
|
398
398
|
raise e
|
@@ -420,7 +420,7 @@ class PluginEntrypoint:
|
|
420
420
|
}
|
421
421
|
except Exception as exception:
|
422
422
|
logger.error(f"Error parsing secrets content for secret {other_secrets_name}: {str(exception)}")
|
423
|
-
raise ValueError("Error parsing secrets content:") from exception
|
423
|
+
raise ValueError(f"Error parsing secrets content: {str(exception)}") from exception
|
424
424
|
return connection_secrets
|
425
425
|
|
426
426
|
def ngrok_post_tunnel_fields(
|
@@ -3,10 +3,10 @@ omnata_plugin_runtime/api.py,sha256=_N5ok5LN7GDO4J9n3yduXp3tpjmhpySY__U2baiygrs,
|
|
3
3
|
omnata_plugin_runtime/configuration.py,sha256=at29ExowF_T4_2U9gY0BF4IVdwC-vDytmNRHL7UCWh8,34742
|
4
4
|
omnata_plugin_runtime/forms.py,sha256=30CJB24TqfLYNnkplZdUbeqA-P9rUIBujVKXw_S-wKY,18371
|
5
5
|
omnata_plugin_runtime/logging.py,sha256=bn7eKoNWvtuyTk7RTwBS9UARMtqkiICtgMtzq3KA2V0,3272
|
6
|
-
omnata_plugin_runtime/omnata_plugin.py,sha256=
|
7
|
-
omnata_plugin_runtime/plugin_entrypoints.py,sha256=
|
6
|
+
omnata_plugin_runtime/omnata_plugin.py,sha256=y9I8ADK74vd1yjj6ma6oaRna9rIRRCWy3HQo_6p8ECA,89661
|
7
|
+
omnata_plugin_runtime/plugin_entrypoints.py,sha256=_XgmWsrHoSshkl5Z2T27BAGVnBh4yH-8lni5sdGlSz8,27670
|
8
8
|
omnata_plugin_runtime/rate_limiting.py,sha256=se6MftQI5NrVHaLb1hByPCgAESPQhkAgIG7KIU1clDU,16562
|
9
|
-
omnata_plugin_runtime-0.3.
|
10
|
-
omnata_plugin_runtime-0.3.
|
11
|
-
omnata_plugin_runtime-0.3.
|
12
|
-
omnata_plugin_runtime-0.3.
|
9
|
+
omnata_plugin_runtime-0.3.9.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
|
10
|
+
omnata_plugin_runtime-0.3.9.dist-info/METADATA,sha256=X4sY5HFP2FKMETC256GYN2hHNt17ctytu1Ht6LyiiSg,1600
|
11
|
+
omnata_plugin_runtime-0.3.9.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
12
|
+
omnata_plugin_runtime-0.3.9.dist-info/RECORD,,
|
File without changes
|