omnata-plugin-runtime 0.3.25a78__py3-none-any.whl → 0.3.26a79__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1415,6 +1415,10 @@ class MonthlyBillingEventRequest(BaseModel):
1415
1415
  # below is deprecated
1416
1416
  has_active_inbound: bool = False
1417
1417
  has_active_outbound: bool = False
1418
+ # had to add these because the old version of the standard billing events assumed a daily billing event
1419
+ # TODO: deprecate all of these once the plugins are all on 0.3.26 or higher
1420
+ billable_connections_inbound: int = 0
1421
+ billable_connections_outbound: int = 0
1418
1422
 
1419
1423
 
1420
1424
  BillingEventRequest = Annotated[Union[DailyBillingEventRequest,MonthlyBillingEventRequest],Field(discriminator='billing_schedule')]
@@ -1622,27 +1626,29 @@ class OmnataPlugin(ABC):
1622
1626
  """
1623
1627
  sent_initial = False
1624
1628
  events: List[SnowflakeBillingEvent] = []
1625
- for i in range(request.billable_connections_inbound + request.billable_connections_outbound):
1626
- if sent_initial is False:
1627
- events.append(
1628
- SnowflakeBillingEvent(
1629
- billing_class="DAILY_ACTIVE_INITIAL",
1630
- billing_subclass="",
1631
- timestamp=datetime.datetime.now(tz=datetime.timezone.utc),
1632
- base_charge=initial_charge,
1633
- )
1634
- )
1635
- sent_initial = True
1636
- else:
1637
- if additional_charge is not None and additional_charge > 0:
1629
+ if request.billing_schedule == "DAILY":
1630
+ for i in range(request.billable_connections_inbound + request.billable_connections_outbound):
1631
+ if sent_initial is False:
1638
1632
  events.append(
1639
1633
  SnowflakeBillingEvent(
1640
- billing_class="DAILY_ACTIVE_ADDITIONAL",
1634
+ billing_class="DAILY_ACTIVE_INITIAL",
1641
1635
  billing_subclass="",
1642
1636
  timestamp=datetime.datetime.now(tz=datetime.timezone.utc),
1643
- base_charge=additional_charge,
1637
+ base_charge=initial_charge,
1644
1638
  )
1645
1639
  )
1640
+ sent_initial = True
1641
+ else:
1642
+ if additional_charge is not None and additional_charge > 0:
1643
+ events.append(
1644
+ SnowflakeBillingEvent(
1645
+ billing_class="DAILY_ACTIVE_ADDITIONAL",
1646
+ billing_subclass="",
1647
+ timestamp=datetime.datetime.now(tz=datetime.timezone.utc),
1648
+ base_charge=additional_charge,
1649
+ )
1650
+ )
1651
+ # handle monthly billing events inside the plugins for now
1646
1652
  return events
1647
1653
 
1648
1654
  def additional_loggers(self) -> List[str]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omnata-plugin-runtime
3
- Version: 0.3.25a78
3
+ Version: 0.3.26a79
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
@@ -3,10 +3,10 @@ omnata_plugin_runtime/api.py,sha256=_N5ok5LN7GDO4J9n3yduXp3tpjmhpySY__U2baiygrs,
3
3
  omnata_plugin_runtime/configuration.py,sha256=7cMekoY8CeZAJHpASU6tCMidF55Hzfr7CD74jtebqIY,35742
4
4
  omnata_plugin_runtime/forms.py,sha256=pw_aKVsXSz47EP8PFBI3VDwdSN5IjvZxp8JTjO1V130,18421
5
5
  omnata_plugin_runtime/logging.py,sha256=bn7eKoNWvtuyTk7RTwBS9UARMtqkiICtgMtzq3KA2V0,3272
6
- omnata_plugin_runtime/omnata_plugin.py,sha256=SYHOE3w134j7TA9ljmdUi1LtKrc7ZyIiozj5ycCHN94,103800
6
+ omnata_plugin_runtime/omnata_plugin.py,sha256=r0LtznaHkoPmWVUZGBdeaVtNZlm-eWQrUhDuvE4p_gQ,104272
7
7
  omnata_plugin_runtime/plugin_entrypoints.py,sha256=D2f0Qih7KTJNXIDYkA-E55RTEK_7Jtv9ySqspWxERVA,28272
8
8
  omnata_plugin_runtime/rate_limiting.py,sha256=se6MftQI5NrVHaLb1hByPCgAESPQhkAgIG7KIU1clDU,16562
9
- omnata_plugin_runtime-0.3.25a78.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
10
- omnata_plugin_runtime-0.3.25a78.dist-info/METADATA,sha256=wO4YXooESIzuIjTq-tsDg55-r4s7r9tXDzF-s5sYN5U,1604
11
- omnata_plugin_runtime-0.3.25a78.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
12
- omnata_plugin_runtime-0.3.25a78.dist-info/RECORD,,
9
+ omnata_plugin_runtime-0.3.26a79.dist-info/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
10
+ omnata_plugin_runtime-0.3.26a79.dist-info/METADATA,sha256=1vRTfVxt5b69ZBQbI0a_ExmZ_fmTJUfxW1kFJnO5E1g,1604
11
+ omnata_plugin_runtime-0.3.26a79.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
12
+ omnata_plugin_runtime-0.3.26a79.dist-info/RECORD,,