omnata-plugin-runtime 0.3.7a19__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.
@@ -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
@@ -554,7 +563,7 @@ class OutboundSyncRequest(SyncRequest):
554
563
  )
555
564
  # upload all cached apply results
556
565
  all_dfs = pandas.concat(self._apply_results)
557
- logger.info(f"applying: {all_dfs}")
566
+ #logger.info(f"applying: {all_dfs}")
558
567
  self._apply_results_dataframe(all_dfs)
559
568
  self._apply_results.clear()
560
569
  else:
@@ -891,7 +900,7 @@ class InboundSyncRequest(SyncRequest):
891
900
  )
892
901
  # upload all cached apply results
893
902
  all_dfs = pandas.concat(results)
894
- logger.info(f"applying: {all_dfs}")
903
+ #logger.info(f"applying: {all_dfs}")
895
904
  self._apply_results_dataframe(stream_name, all_dfs)
896
905
  # add the count of this batch to the total for this stream
897
906
  self._stream_record_counts[
@@ -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 BillingEventRequest(BaseModel):
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["DAILY"]
1217
- has_active_inbound: bool
1218
- has_active_outbound: bool
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
- # BillingEventRequest = Annotated[Union[DailyBillingEventRequest,...],Field(discriminator='billing_schedule')]
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.3.7a19
3
+ Version: 0.3.9
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=w63LVME5nY-hQ4BBzfacy9kvTunwqHGs8iiSPGAX2ns,1214
2
+ omnata_plugin_runtime/api.py,sha256=_N5ok5LN7GDO4J9n3yduXp3tpjmhpySY__U2baiygrs,6217
3
+ omnata_plugin_runtime/configuration.py,sha256=at29ExowF_T4_2U9gY0BF4IVdwC-vDytmNRHL7UCWh8,34742
4
+ omnata_plugin_runtime/forms.py,sha256=30CJB24TqfLYNnkplZdUbeqA-P9rUIBujVKXw_S-wKY,18371
5
+ omnata_plugin_runtime/logging.py,sha256=bn7eKoNWvtuyTk7RTwBS9UARMtqkiICtgMtzq3KA2V0,3272
6
+ omnata_plugin_runtime/omnata_plugin.py,sha256=y9I8ADK74vd1yjj6ma6oaRna9rIRRCWy3HQo_6p8ECA,89661
7
+ omnata_plugin_runtime/plugin_entrypoints.py,sha256=_XgmWsrHoSshkl5Z2T27BAGVnBh4yH-8lni5sdGlSz8,27670
8
+ omnata_plugin_runtime/rate_limiting.py,sha256=se6MftQI5NrVHaLb1hByPCgAESPQhkAgIG7KIU1clDU,16562
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,,
@@ -1,12 +0,0 @@
1
- omnata_plugin_runtime/__init__.py,sha256=w63LVME5nY-hQ4BBzfacy9kvTunwqHGs8iiSPGAX2ns,1214
2
- omnata_plugin_runtime/api.py,sha256=_N5ok5LN7GDO4J9n3yduXp3tpjmhpySY__U2baiygrs,6217
3
- omnata_plugin_runtime/configuration.py,sha256=at29ExowF_T4_2U9gY0BF4IVdwC-vDytmNRHL7UCWh8,34742
4
- omnata_plugin_runtime/forms.py,sha256=30CJB24TqfLYNnkplZdUbeqA-P9rUIBujVKXw_S-wKY,18371
5
- omnata_plugin_runtime/logging.py,sha256=bn7eKoNWvtuyTk7RTwBS9UARMtqkiICtgMtzq3KA2V0,3272
6
- omnata_plugin_runtime/omnata_plugin.py,sha256=oOB_PUU0qCUzJDEyKnlKo9_j-GVPugIEuf-0EthBJLU,88491
7
- omnata_plugin_runtime/plugin_entrypoints.py,sha256=T6cGdEacgGxoMT9xWJ2DayeDanu8cO58kicdqKsp4Uw,27604
8
- omnata_plugin_runtime/rate_limiting.py,sha256=se6MftQI5NrVHaLb1hByPCgAESPQhkAgIG7KIU1clDU,16562
9
- omnata_plugin_runtime-0.3.7a19.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
10
- omnata_plugin_runtime-0.3.7a19.dist-info/METADATA,sha256=MlCJf2wIHxVVs3FYqzdazH3NnBBz69qorTrv8SOliNI,1603
11
- omnata_plugin_runtime-0.3.7a19.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
12
- omnata_plugin_runtime-0.3.7a19.dist-info/RECORD,,