deeporigin-sdk 4.7.0__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.
- deeporigin_sdk/VERSION +1 -0
- deeporigin_sdk/__init__.py +49 -0
- deeporigin_sdk/auth.py +290 -0
- deeporigin_sdk/config.py +184 -0
- deeporigin_sdk/exceptions.py +125 -0
- deeporigin_sdk/platform/__init__.py +23 -0
- deeporigin_sdk/platform/billing.py +56 -0
- deeporigin_sdk/platform/client.py +990 -0
- deeporigin_sdk/platform/clusters.py +81 -0
- deeporigin_sdk/platform/constants.py +22 -0
- deeporigin_sdk/platform/executions.py +122 -0
- deeporigin_sdk/platform/files.py +453 -0
- deeporigin_sdk/platform/functions.py +187 -0
- deeporigin_sdk/platform/job.py +1735 -0
- deeporigin_sdk/platform/job_viz_functions.py +485 -0
- deeporigin_sdk/platform/organizations.py +57 -0
- deeporigin_sdk/platform/tools.py +85 -0
- deeporigin_sdk/utils/__init__.py +0 -0
- deeporigin_sdk/utils/constants.py +33 -0
- deeporigin_sdk/utils/core.py +449 -0
- deeporigin_sdk/utils/network.py +85 -0
- deeporigin_sdk-4.7.0.dist-info/METADATA +11 -0
- deeporigin_sdk-4.7.0.dist-info/RECORD +25 -0
- deeporigin_sdk-4.7.0.dist-info/WHEEL +5 -0
- deeporigin_sdk-4.7.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""Billing API wrapper for DeepOriginClient."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from datetime import date
|
|
6
|
+
from typing import TYPE_CHECKING
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from deeporigin_sdk.platform.client import DeepOriginClient
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Billing:
|
|
13
|
+
"""Billing API wrapper.
|
|
14
|
+
|
|
15
|
+
Provides access to billing-related endpoints through the DeepOriginClient.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
def __init__(self, client: DeepOriginClient) -> None:
|
|
19
|
+
"""Initialize Billing wrapper.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
client: The DeepOriginClient instance to use for API calls.
|
|
23
|
+
"""
|
|
24
|
+
self._c = client
|
|
25
|
+
|
|
26
|
+
def get_usage_by_tag(
|
|
27
|
+
self,
|
|
28
|
+
*,
|
|
29
|
+
tag: str,
|
|
30
|
+
start_date: str = "2020-01-01",
|
|
31
|
+
end_date: str | None = None,
|
|
32
|
+
) -> dict:
|
|
33
|
+
"""Get usage information for a billing tag within a date range.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
tag: The billing tag to get usage for.
|
|
37
|
+
start_date: Start date in YYYY-MM-DD format.
|
|
38
|
+
end_date: End date in YYYY-MM-DD format. Defaults to today's date.
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
Dictionary containing usage information.
|
|
42
|
+
"""
|
|
43
|
+
if end_date is None:
|
|
44
|
+
end_date = date.today().strftime("%Y-%m-%d")
|
|
45
|
+
|
|
46
|
+
params = {
|
|
47
|
+
"startDate": start_date,
|
|
48
|
+
"endDate": end_date,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
response = self._c.get_json(
|
|
52
|
+
f"/billing/{self._c.org_key}/usage/{tag}",
|
|
53
|
+
params=params,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
return response
|