omnata-plugin-runtime 0.2.37__tar.gz → 0.2.40__tar.gz
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-0.2.37 → omnata_plugin_runtime-0.2.40}/PKG-INFO +1 -1
- {omnata_plugin_runtime-0.2.37 → omnata_plugin_runtime-0.2.40}/pyproject.toml +1 -1
- {omnata_plugin_runtime-0.2.37 → omnata_plugin_runtime-0.2.40}/src/omnata_plugin_runtime/omnata_plugin.py +16 -2
- {omnata_plugin_runtime-0.2.37 → omnata_plugin_runtime-0.2.40}/LICENSE +0 -0
- {omnata_plugin_runtime-0.2.37 → omnata_plugin_runtime-0.2.40}/README.md +0 -0
- {omnata_plugin_runtime-0.2.37 → omnata_plugin_runtime-0.2.40}/src/omnata_plugin_runtime/__init__.py +0 -0
- {omnata_plugin_runtime-0.2.37 → omnata_plugin_runtime-0.2.40}/src/omnata_plugin_runtime/api.py +0 -0
- {omnata_plugin_runtime-0.2.37 → omnata_plugin_runtime-0.2.40}/src/omnata_plugin_runtime/configuration.py +0 -0
- {omnata_plugin_runtime-0.2.37 → omnata_plugin_runtime-0.2.40}/src/omnata_plugin_runtime/forms.py +0 -0
- {omnata_plugin_runtime-0.2.37 → omnata_plugin_runtime-0.2.40}/src/omnata_plugin_runtime/logging.py +0 -0
- {omnata_plugin_runtime-0.2.37 → omnata_plugin_runtime-0.2.40}/src/omnata_plugin_runtime/plugin_entrypoints.py +0 -0
- {omnata_plugin_runtime-0.2.37 → omnata_plugin_runtime-0.2.40}/src/omnata_plugin_runtime/rate_limiting.py +0 -0
@@ -20,7 +20,7 @@ import jinja2
|
|
20
20
|
import pandas
|
21
21
|
import pydantic
|
22
22
|
import pydantic.json
|
23
|
-
from pydantic import parse_obj_as
|
23
|
+
from pydantic import parse_obj_as, root_validator
|
24
24
|
from dateutil.parser import parse
|
25
25
|
from jinja2 import Environment
|
26
26
|
from pydantic import BaseModel # pylint: disable=no-name-in-module
|
@@ -1144,12 +1144,26 @@ class SnowflakeBillingEvent(BaseModel):
|
|
1144
1144
|
|
1145
1145
|
billing_class: str
|
1146
1146
|
base_charge: Decimal
|
1147
|
-
timestamp: datetime.datetime = datetime.datetime.now()
|
1147
|
+
timestamp: datetime.datetime = datetime.datetime.now(tz=datetime.timezone.utc)
|
1148
1148
|
sub_class: Optional[str] = None
|
1149
1149
|
start_timestamp: Optional[datetime.datetime] = None
|
1150
1150
|
objects: List[str] = []
|
1151
1151
|
additional_info: Dict[str, Any] = {}
|
1152
1152
|
|
1153
|
+
@root_validator(pre=True)
|
1154
|
+
def validate_datetime_fields(cls, values):
|
1155
|
+
# Handling timestamps, we want to be strict on supplying a timezone
|
1156
|
+
timestamp = values.get('timestamp')
|
1157
|
+
if timestamp is not None and isinstance(timestamp, datetime.datetime):
|
1158
|
+
if timestamp.tzinfo is None or timestamp.tzinfo.utcoffset(timestamp) is None:
|
1159
|
+
raise ValueError("timestamp must be timezone aware")
|
1160
|
+
|
1161
|
+
start_timestamp = values.get('start_timestamp')
|
1162
|
+
if start_timestamp is not None and isinstance(start_timestamp, datetime.datetime):
|
1163
|
+
if start_timestamp.tzinfo is None or start_timestamp.tzinfo.utcoffset(start_timestamp) is None:
|
1164
|
+
raise ValueError("start_timestamp must be timezone aware")
|
1165
|
+
return values
|
1166
|
+
|
1153
1167
|
class BillingEventRequest(BaseModel):
|
1154
1168
|
"""
|
1155
1169
|
Represents a request to provide billing events for that day.
|
File without changes
|
File without changes
|
{omnata_plugin_runtime-0.2.37 → omnata_plugin_runtime-0.2.40}/src/omnata_plugin_runtime/__init__.py
RENAMED
File without changes
|
{omnata_plugin_runtime-0.2.37 → omnata_plugin_runtime-0.2.40}/src/omnata_plugin_runtime/api.py
RENAMED
File without changes
|
File without changes
|
{omnata_plugin_runtime-0.2.37 → omnata_plugin_runtime-0.2.40}/src/omnata_plugin_runtime/forms.py
RENAMED
File without changes
|
{omnata_plugin_runtime-0.2.37 → omnata_plugin_runtime-0.2.40}/src/omnata_plugin_runtime/logging.py
RENAMED
File without changes
|
File without changes
|
File without changes
|