hatchet-sdk 1.9.0__py3-none-any.whl → 1.10.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.
Potentially problematic release.
This version of hatchet-sdk might be problematic. Click here for more details.
- hatchet_sdk/client.py +2 -0
- hatchet_sdk/clients/admin.py +2 -6
- hatchet_sdk/clients/dispatcher/action_listener.py +20 -1
- hatchet_sdk/clients/events.py +58 -8
- hatchet_sdk/clients/rest/__init__.py +11 -0
- hatchet_sdk/clients/rest/api/__init__.py +1 -0
- hatchet_sdk/clients/rest/api/event_api.py +335 -0
- hatchet_sdk/clients/rest/api/filter_api.py +1305 -0
- hatchet_sdk/clients/rest/api/task_api.py +51 -0
- hatchet_sdk/clients/rest/api/workflow_runs_api.py +34 -0
- hatchet_sdk/clients/rest/models/__init__.py +10 -0
- hatchet_sdk/clients/rest/models/create_event_request.py +16 -2
- hatchet_sdk/clients/rest/models/v1_create_filter_request.py +99 -0
- hatchet_sdk/clients/rest/models/v1_event.py +142 -0
- hatchet_sdk/clients/rest/models/v1_event_list.py +110 -0
- hatchet_sdk/clients/rest/models/v1_event_workflow_run_summary.py +101 -0
- hatchet_sdk/clients/rest/models/v1_filter.py +127 -0
- hatchet_sdk/clients/rest/models/v1_filter_list.py +110 -0
- hatchet_sdk/clients/rest/models/v1_log_line.py +21 -2
- hatchet_sdk/clients/rest/models/v1_task_event.py +12 -0
- hatchet_sdk/clients/rest/models/v1_task_summary.py +12 -0
- hatchet_sdk/clients/rest/models/v1_task_timing.py +19 -0
- hatchet_sdk/clients/rest/models/workflow.py +5 -0
- hatchet_sdk/config.py +29 -0
- hatchet_sdk/context/context.py +9 -0
- hatchet_sdk/contracts/dispatcher_pb2.py +56 -56
- hatchet_sdk/contracts/dispatcher_pb2.pyi +6 -2
- hatchet_sdk/contracts/events_pb2.py +20 -20
- hatchet_sdk/contracts/events_pb2.pyi +14 -6
- hatchet_sdk/features/cron.py +1 -1
- hatchet_sdk/features/filters.py +181 -0
- hatchet_sdk/features/runs.py +7 -1
- hatchet_sdk/features/scheduled.py +1 -1
- hatchet_sdk/features/workflows.py +1 -1
- hatchet_sdk/hatchet.py +82 -71
- hatchet_sdk/runnables/standalone.py +6 -0
- hatchet_sdk/runnables/workflow.py +29 -2
- hatchet_sdk/worker/worker.py +1 -1
- {hatchet_sdk-1.9.0.dist-info → hatchet_sdk-1.10.0.dist-info}/METADATA +1 -1
- {hatchet_sdk-1.9.0.dist-info → hatchet_sdk-1.10.0.dist-info}/RECORD +42 -34
- {hatchet_sdk-1.9.0.dist-info → hatchet_sdk-1.10.0.dist-info}/WHEEL +0 -0
- {hatchet_sdk-1.9.0.dist-info → hatchet_sdk-1.10.0.dist-info}/entry_points.txt +0 -0
hatchet_sdk/client.py
CHANGED
|
@@ -5,6 +5,7 @@ from hatchet_sdk.clients.listeners.run_event_listener import RunEventListenerCli
|
|
|
5
5
|
from hatchet_sdk.clients.listeners.workflow_listener import PooledWorkflowRunListener
|
|
6
6
|
from hatchet_sdk.config import ClientConfig
|
|
7
7
|
from hatchet_sdk.features.cron import CronClient
|
|
8
|
+
from hatchet_sdk.features.filters import FiltersClient
|
|
8
9
|
from hatchet_sdk.features.logs import LogsClient
|
|
9
10
|
from hatchet_sdk.features.metrics import MetricsClient
|
|
10
11
|
from hatchet_sdk.features.rate_limits import RateLimitsClient
|
|
@@ -34,6 +35,7 @@ class Client:
|
|
|
34
35
|
self.debug = debug
|
|
35
36
|
|
|
36
37
|
self.cron = CronClient(self.config)
|
|
38
|
+
self.filters = FiltersClient(self.config)
|
|
37
39
|
self.logs = LogsClient(self.config)
|
|
38
40
|
self.metrics = MetricsClient(self.config)
|
|
39
41
|
self.rate_limits = RateLimitsClient(self.config)
|
hatchet_sdk/clients/admin.py
CHANGED
|
@@ -46,9 +46,7 @@ class ScheduleTriggerWorkflowOptions(BaseModel):
|
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
class TriggerWorkflowOptions(ScheduleTriggerWorkflowOptions):
|
|
49
|
-
additional_metadata: JSONSerializableMapping = Field(default_factory=dict)
|
|
50
49
|
desired_worker_id: str | None = None
|
|
51
|
-
namespace: str | None = None
|
|
52
50
|
sticky: bool = False
|
|
53
51
|
key: str | None = None
|
|
54
52
|
|
|
@@ -253,8 +251,7 @@ class AdminClient:
|
|
|
253
251
|
try:
|
|
254
252
|
namespace = options.namespace or self.namespace
|
|
255
253
|
|
|
256
|
-
|
|
257
|
-
name = f"{namespace}{name}"
|
|
254
|
+
name = self.config.apply_namespace(name, namespace)
|
|
258
255
|
|
|
259
256
|
request = self._prepare_schedule_workflow_request(
|
|
260
257
|
name, schedules, input, options
|
|
@@ -312,8 +309,7 @@ class AdminClient:
|
|
|
312
309
|
|
|
313
310
|
namespace = options.namespace or self.namespace
|
|
314
311
|
|
|
315
|
-
|
|
316
|
-
workflow_name = f"{namespace}{workflow_name}"
|
|
312
|
+
workflow_name = self.config.apply_namespace(workflow_name, namespace)
|
|
317
313
|
|
|
318
314
|
return self._prepare_workflow_request(workflow_name, input, trigger_options)
|
|
319
315
|
|
|
@@ -73,14 +73,27 @@ class ActionPayload(BaseModel):
|
|
|
73
73
|
step_run_errors: dict[str, str] = Field(default_factory=dict)
|
|
74
74
|
triggered_by: str | None = None
|
|
75
75
|
triggers: JSONSerializableMapping = Field(default_factory=dict)
|
|
76
|
+
filter_payload: JSONSerializableMapping = Field(default_factory=dict)
|
|
76
77
|
|
|
77
78
|
@field_validator(
|
|
78
|
-
"input",
|
|
79
|
+
"input",
|
|
80
|
+
"parents",
|
|
81
|
+
"overrides",
|
|
82
|
+
"user_data",
|
|
83
|
+
"step_run_errors",
|
|
84
|
+
"filter_payload",
|
|
85
|
+
mode="before",
|
|
79
86
|
)
|
|
80
87
|
@classmethod
|
|
81
88
|
def validate_fields(cls, v: Any) -> Any:
|
|
82
89
|
return v or {}
|
|
83
90
|
|
|
91
|
+
@model_validator(mode="after")
|
|
92
|
+
def validate_filter_payload(self) -> "ActionPayload":
|
|
93
|
+
self.filter_payload = self.triggers.get("filter_payload", {})
|
|
94
|
+
|
|
95
|
+
return self
|
|
96
|
+
|
|
84
97
|
|
|
85
98
|
class ActionType(str, Enum):
|
|
86
99
|
START_STEP_RUN = "START_STEP_RUN"
|
|
@@ -95,6 +108,8 @@ class Action(BaseModel):
|
|
|
95
108
|
worker_id: str
|
|
96
109
|
tenant_id: str
|
|
97
110
|
workflow_run_id: str
|
|
111
|
+
workflow_id: str | None = None
|
|
112
|
+
workflow_version_id: str | None = None
|
|
98
113
|
get_group_key_run_id: str
|
|
99
114
|
job_id: str
|
|
100
115
|
job_name: str
|
|
@@ -140,6 +155,8 @@ class Action(BaseModel):
|
|
|
140
155
|
"hatchet.workflow_name": self.job_name,
|
|
141
156
|
"hatchet.action_name": self.action_id,
|
|
142
157
|
"hatchet.get_group_key_run_id": self.get_group_key_run_id,
|
|
158
|
+
"hatchet.workflow_id": self.workflow_id,
|
|
159
|
+
"hatchet.workflow_version_id": self.workflow_version_id,
|
|
143
160
|
}
|
|
144
161
|
|
|
145
162
|
return {k: v for k, v in attrs.items() if v}
|
|
@@ -343,6 +360,8 @@ class ActionListener:
|
|
|
343
360
|
child_workflow_key=assigned_action.child_workflow_key,
|
|
344
361
|
parent_workflow_run_id=assigned_action.parent_workflow_run_id,
|
|
345
362
|
priority=assigned_action.priority,
|
|
363
|
+
workflow_version_id=assigned_action.workflowVersionId,
|
|
364
|
+
workflow_id=assigned_action.workflowId,
|
|
346
365
|
)
|
|
347
366
|
|
|
348
367
|
yield action
|
hatchet_sdk/clients/events.py
CHANGED
|
@@ -6,7 +6,12 @@ from typing import List, cast
|
|
|
6
6
|
from google.protobuf import timestamp_pb2
|
|
7
7
|
from pydantic import BaseModel, Field
|
|
8
8
|
|
|
9
|
+
from hatchet_sdk.clients.rest.api.event_api import EventApi
|
|
10
|
+
from hatchet_sdk.clients.rest.api.workflow_runs_api import WorkflowRunsApi
|
|
11
|
+
from hatchet_sdk.clients.rest.api_client import ApiClient
|
|
12
|
+
from hatchet_sdk.clients.rest.models.v1_event_list import V1EventList
|
|
9
13
|
from hatchet_sdk.clients.rest.tenacity_utils import tenacity_retry
|
|
14
|
+
from hatchet_sdk.clients.v1.api_client import BaseRestClient
|
|
10
15
|
from hatchet_sdk.config import ClientConfig
|
|
11
16
|
from hatchet_sdk.connection import new_conn
|
|
12
17
|
from hatchet_sdk.contracts.events_pb2 import (
|
|
@@ -33,6 +38,8 @@ def proto_timestamp_now() -> timestamp_pb2.Timestamp:
|
|
|
33
38
|
class PushEventOptions(BaseModel):
|
|
34
39
|
additional_metadata: JSONSerializableMapping = Field(default_factory=dict)
|
|
35
40
|
namespace: str | None = None
|
|
41
|
+
priority: int | None = None
|
|
42
|
+
scope: str | None = None
|
|
36
43
|
|
|
37
44
|
|
|
38
45
|
class BulkPushEventOptions(BaseModel):
|
|
@@ -43,16 +50,26 @@ class BulkPushEventWithMetadata(BaseModel):
|
|
|
43
50
|
key: str
|
|
44
51
|
payload: JSONSerializableMapping = Field(default_factory=dict)
|
|
45
52
|
additional_metadata: JSONSerializableMapping = Field(default_factory=dict)
|
|
53
|
+
priority: int | None = None
|
|
54
|
+
scope: str | None = None
|
|
46
55
|
|
|
47
56
|
|
|
48
|
-
class EventClient:
|
|
57
|
+
class EventClient(BaseRestClient):
|
|
49
58
|
def __init__(self, config: ClientConfig):
|
|
59
|
+
super().__init__(config)
|
|
60
|
+
|
|
50
61
|
conn = new_conn(config, False)
|
|
51
|
-
self.
|
|
62
|
+
self.events_service_client = EventsServiceStub(conn)
|
|
52
63
|
|
|
53
64
|
self.token = config.token
|
|
54
65
|
self.namespace = config.namespace
|
|
55
66
|
|
|
67
|
+
def _wra(self, client: ApiClient) -> WorkflowRunsApi:
|
|
68
|
+
return WorkflowRunsApi(client)
|
|
69
|
+
|
|
70
|
+
def _ea(self, client: ApiClient) -> EventApi:
|
|
71
|
+
return EventApi(client)
|
|
72
|
+
|
|
56
73
|
async def aio_push(
|
|
57
74
|
self,
|
|
58
75
|
event_key: str,
|
|
@@ -79,7 +96,7 @@ class EventClient:
|
|
|
79
96
|
options: PushEventOptions = PushEventOptions(),
|
|
80
97
|
) -> Event:
|
|
81
98
|
namespace = options.namespace or self.namespace
|
|
82
|
-
namespaced_event_key = namespace
|
|
99
|
+
namespaced_event_key = self.client_config.apply_namespace(event_key, namespace)
|
|
83
100
|
|
|
84
101
|
try:
|
|
85
102
|
meta_bytes = json.dumps(options.additional_metadata)
|
|
@@ -96,16 +113,21 @@ class EventClient:
|
|
|
96
113
|
payload=payload_str,
|
|
97
114
|
eventTimestamp=proto_timestamp_now(),
|
|
98
115
|
additionalMetadata=meta_bytes,
|
|
116
|
+
priority=options.priority,
|
|
117
|
+
scope=options.scope,
|
|
99
118
|
)
|
|
100
119
|
|
|
101
|
-
return cast(
|
|
120
|
+
return cast(
|
|
121
|
+
Event,
|
|
122
|
+
self.events_service_client.Push(request, metadata=get_metadata(self.token)),
|
|
123
|
+
)
|
|
102
124
|
|
|
103
125
|
def _create_push_event_request(
|
|
104
126
|
self,
|
|
105
127
|
event: BulkPushEventWithMetadata,
|
|
106
128
|
namespace: str,
|
|
107
129
|
) -> PushEventRequest:
|
|
108
|
-
event_key =
|
|
130
|
+
event_key = self.client_config.apply_namespace(event.key, namespace)
|
|
109
131
|
payload = event.payload
|
|
110
132
|
|
|
111
133
|
meta = event.additional_metadata
|
|
@@ -125,6 +147,8 @@ class EventClient:
|
|
|
125
147
|
payload=serialized_payload,
|
|
126
148
|
eventTimestamp=proto_timestamp_now(),
|
|
127
149
|
additionalMetadata=meta_str,
|
|
150
|
+
priority=event.priority,
|
|
151
|
+
scope=event.scope,
|
|
128
152
|
)
|
|
129
153
|
|
|
130
154
|
## IMPORTANT: Keep this method's signature in sync with the wrapper in the OTel instrumentor
|
|
@@ -145,7 +169,9 @@ class EventClient:
|
|
|
145
169
|
return list(
|
|
146
170
|
cast(
|
|
147
171
|
Events,
|
|
148
|
-
self.
|
|
172
|
+
self.events_service_client.BulkPush(
|
|
173
|
+
bulk_request, metadata=get_metadata(self.token)
|
|
174
|
+
),
|
|
149
175
|
).events
|
|
150
176
|
)
|
|
151
177
|
|
|
@@ -157,7 +183,7 @@ class EventClient:
|
|
|
157
183
|
message=message,
|
|
158
184
|
)
|
|
159
185
|
|
|
160
|
-
self.
|
|
186
|
+
self.events_service_client.PutLog(request, metadata=get_metadata(self.token))
|
|
161
187
|
|
|
162
188
|
@tenacity_retry
|
|
163
189
|
def stream(self, data: str | bytes, step_run_id: str) -> None:
|
|
@@ -174,4 +200,28 @@ class EventClient:
|
|
|
174
200
|
message=data_bytes,
|
|
175
201
|
)
|
|
176
202
|
|
|
177
|
-
self.
|
|
203
|
+
self.events_service_client.PutStreamEvent(
|
|
204
|
+
request, metadata=get_metadata(self.token)
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
async def aio_list(
|
|
208
|
+
self,
|
|
209
|
+
offset: int | None = None,
|
|
210
|
+
limit: int | None = None,
|
|
211
|
+
keys: list[str] | None = None,
|
|
212
|
+
) -> V1EventList:
|
|
213
|
+
return await asyncio.to_thread(self.list, offset=offset, limit=limit, keys=keys)
|
|
214
|
+
|
|
215
|
+
def list(
|
|
216
|
+
self,
|
|
217
|
+
offset: int | None = None,
|
|
218
|
+
limit: int | None = None,
|
|
219
|
+
keys: list[str] | None = None,
|
|
220
|
+
) -> V1EventList:
|
|
221
|
+
with self.client() as client:
|
|
222
|
+
return self._ea(client).v1_event_list(
|
|
223
|
+
tenant=self.client_config.tenant_id,
|
|
224
|
+
offset=offset,
|
|
225
|
+
limit=limit,
|
|
226
|
+
keys=keys,
|
|
227
|
+
)
|
|
@@ -20,6 +20,7 @@ __version__ = "1.0.0"
|
|
|
20
20
|
from hatchet_sdk.clients.rest.api.api_token_api import APITokenApi
|
|
21
21
|
from hatchet_sdk.clients.rest.api.default_api import DefaultApi
|
|
22
22
|
from hatchet_sdk.clients.rest.api.event_api import EventApi
|
|
23
|
+
from hatchet_sdk.clients.rest.api.filter_api import FilterApi
|
|
23
24
|
from hatchet_sdk.clients.rest.api.github_api import GithubApi
|
|
24
25
|
from hatchet_sdk.clients.rest.api.healthcheck_api import HealthcheckApi
|
|
25
26
|
from hatchet_sdk.clients.rest.api.log_api import LogApi
|
|
@@ -229,7 +230,17 @@ from hatchet_sdk.clients.rest.models.user_tenant_memberships_list import (
|
|
|
229
230
|
)
|
|
230
231
|
from hatchet_sdk.clients.rest.models.user_tenant_public import UserTenantPublic
|
|
231
232
|
from hatchet_sdk.clients.rest.models.v1_cancel_task_request import V1CancelTaskRequest
|
|
233
|
+
from hatchet_sdk.clients.rest.models.v1_create_filter_request import (
|
|
234
|
+
V1CreateFilterRequest,
|
|
235
|
+
)
|
|
232
236
|
from hatchet_sdk.clients.rest.models.v1_dag_children import V1DagChildren
|
|
237
|
+
from hatchet_sdk.clients.rest.models.v1_event import V1Event
|
|
238
|
+
from hatchet_sdk.clients.rest.models.v1_event_list import V1EventList
|
|
239
|
+
from hatchet_sdk.clients.rest.models.v1_event_workflow_run_summary import (
|
|
240
|
+
V1EventWorkflowRunSummary,
|
|
241
|
+
)
|
|
242
|
+
from hatchet_sdk.clients.rest.models.v1_filter import V1Filter
|
|
243
|
+
from hatchet_sdk.clients.rest.models.v1_filter_list import V1FilterList
|
|
233
244
|
from hatchet_sdk.clients.rest.models.v1_log_line import V1LogLine
|
|
234
245
|
from hatchet_sdk.clients.rest.models.v1_log_line_level import V1LogLineLevel
|
|
235
246
|
from hatchet_sdk.clients.rest.models.v1_log_line_list import V1LogLineList
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
from hatchet_sdk.clients.rest.api.api_token_api import APITokenApi
|
|
5
5
|
from hatchet_sdk.clients.rest.api.default_api import DefaultApi
|
|
6
6
|
from hatchet_sdk.clients.rest.api.event_api import EventApi
|
|
7
|
+
from hatchet_sdk.clients.rest.api.filter_api import FilterApi
|
|
7
8
|
from hatchet_sdk.clients.rest.api.github_api import GithubApi
|
|
8
9
|
from hatchet_sdk.clients.rest.api.healthcheck_api import HealthcheckApi
|
|
9
10
|
from hatchet_sdk.clients.rest.api.log_api import LogApi
|
|
@@ -37,6 +37,7 @@ from hatchet_sdk.clients.rest.models.event_update_cancel200_response import (
|
|
|
37
37
|
)
|
|
38
38
|
from hatchet_sdk.clients.rest.models.events import Events
|
|
39
39
|
from hatchet_sdk.clients.rest.models.replay_event_request import ReplayEventRequest
|
|
40
|
+
from hatchet_sdk.clients.rest.models.v1_event_list import V1EventList
|
|
40
41
|
from hatchet_sdk.clients.rest.models.workflow_run_status import WorkflowRunStatus
|
|
41
42
|
from hatchet_sdk.clients.rest.rest import RESTResponseType
|
|
42
43
|
|
|
@@ -2546,3 +2547,337 @@ class EventApi:
|
|
|
2546
2547
|
_host=_host,
|
|
2547
2548
|
_request_auth=_request_auth,
|
|
2548
2549
|
)
|
|
2550
|
+
|
|
2551
|
+
@validate_call
|
|
2552
|
+
def v1_event_list(
|
|
2553
|
+
self,
|
|
2554
|
+
tenant: Annotated[
|
|
2555
|
+
str,
|
|
2556
|
+
Field(
|
|
2557
|
+
min_length=36, strict=True, max_length=36, description="The tenant id"
|
|
2558
|
+
),
|
|
2559
|
+
],
|
|
2560
|
+
offset: Annotated[
|
|
2561
|
+
Optional[StrictInt], Field(description="The number to skip")
|
|
2562
|
+
] = None,
|
|
2563
|
+
limit: Annotated[
|
|
2564
|
+
Optional[StrictInt], Field(description="The number to limit by")
|
|
2565
|
+
] = None,
|
|
2566
|
+
keys: Annotated[
|
|
2567
|
+
Optional[List[StrictStr]], Field(description="A list of keys to filter by")
|
|
2568
|
+
] = None,
|
|
2569
|
+
_request_timeout: Union[
|
|
2570
|
+
None,
|
|
2571
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
2572
|
+
Tuple[
|
|
2573
|
+
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
|
|
2574
|
+
],
|
|
2575
|
+
] = None,
|
|
2576
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
2577
|
+
_content_type: Optional[StrictStr] = None,
|
|
2578
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
2579
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
2580
|
+
) -> V1EventList:
|
|
2581
|
+
"""List events
|
|
2582
|
+
|
|
2583
|
+
Lists all events for a tenant.
|
|
2584
|
+
|
|
2585
|
+
:param tenant: The tenant id (required)
|
|
2586
|
+
:type tenant: str
|
|
2587
|
+
:param offset: The number to skip
|
|
2588
|
+
:type offset: int
|
|
2589
|
+
:param limit: The number to limit by
|
|
2590
|
+
:type limit: int
|
|
2591
|
+
:param keys: A list of keys to filter by
|
|
2592
|
+
:type keys: List[str]
|
|
2593
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
2594
|
+
number provided, it will be total request
|
|
2595
|
+
timeout. It can also be a pair (tuple) of
|
|
2596
|
+
(connection, read) timeouts.
|
|
2597
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
2598
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
2599
|
+
request; this effectively ignores the
|
|
2600
|
+
authentication in the spec for a single request.
|
|
2601
|
+
:type _request_auth: dict, optional
|
|
2602
|
+
:param _content_type: force content-type for the request.
|
|
2603
|
+
:type _content_type: str, Optional
|
|
2604
|
+
:param _headers: set to override the headers for a single
|
|
2605
|
+
request; this effectively ignores the headers
|
|
2606
|
+
in the spec for a single request.
|
|
2607
|
+
:type _headers: dict, optional
|
|
2608
|
+
:param _host_index: set to override the host_index for a single
|
|
2609
|
+
request; this effectively ignores the host_index
|
|
2610
|
+
in the spec for a single request.
|
|
2611
|
+
:type _host_index: int, optional
|
|
2612
|
+
:return: Returns the result object.
|
|
2613
|
+
""" # noqa: E501
|
|
2614
|
+
|
|
2615
|
+
_param = self._v1_event_list_serialize(
|
|
2616
|
+
tenant=tenant,
|
|
2617
|
+
offset=offset,
|
|
2618
|
+
limit=limit,
|
|
2619
|
+
keys=keys,
|
|
2620
|
+
_request_auth=_request_auth,
|
|
2621
|
+
_content_type=_content_type,
|
|
2622
|
+
_headers=_headers,
|
|
2623
|
+
_host_index=_host_index,
|
|
2624
|
+
)
|
|
2625
|
+
|
|
2626
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
2627
|
+
"200": "V1EventList",
|
|
2628
|
+
"400": "APIErrors",
|
|
2629
|
+
"403": "APIErrors",
|
|
2630
|
+
}
|
|
2631
|
+
response_data = self.api_client.call_api(
|
|
2632
|
+
*_param, _request_timeout=_request_timeout
|
|
2633
|
+
)
|
|
2634
|
+
response_data.read()
|
|
2635
|
+
return self.api_client.response_deserialize(
|
|
2636
|
+
response_data=response_data,
|
|
2637
|
+
response_types_map=_response_types_map,
|
|
2638
|
+
).data
|
|
2639
|
+
|
|
2640
|
+
@validate_call
|
|
2641
|
+
def v1_event_list_with_http_info(
|
|
2642
|
+
self,
|
|
2643
|
+
tenant: Annotated[
|
|
2644
|
+
str,
|
|
2645
|
+
Field(
|
|
2646
|
+
min_length=36, strict=True, max_length=36, description="The tenant id"
|
|
2647
|
+
),
|
|
2648
|
+
],
|
|
2649
|
+
offset: Annotated[
|
|
2650
|
+
Optional[StrictInt], Field(description="The number to skip")
|
|
2651
|
+
] = None,
|
|
2652
|
+
limit: Annotated[
|
|
2653
|
+
Optional[StrictInt], Field(description="The number to limit by")
|
|
2654
|
+
] = None,
|
|
2655
|
+
keys: Annotated[
|
|
2656
|
+
Optional[List[StrictStr]], Field(description="A list of keys to filter by")
|
|
2657
|
+
] = None,
|
|
2658
|
+
_request_timeout: Union[
|
|
2659
|
+
None,
|
|
2660
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
2661
|
+
Tuple[
|
|
2662
|
+
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
|
|
2663
|
+
],
|
|
2664
|
+
] = None,
|
|
2665
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
2666
|
+
_content_type: Optional[StrictStr] = None,
|
|
2667
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
2668
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
2669
|
+
) -> ApiResponse[V1EventList]:
|
|
2670
|
+
"""List events
|
|
2671
|
+
|
|
2672
|
+
Lists all events for a tenant.
|
|
2673
|
+
|
|
2674
|
+
:param tenant: The tenant id (required)
|
|
2675
|
+
:type tenant: str
|
|
2676
|
+
:param offset: The number to skip
|
|
2677
|
+
:type offset: int
|
|
2678
|
+
:param limit: The number to limit by
|
|
2679
|
+
:type limit: int
|
|
2680
|
+
:param keys: A list of keys to filter by
|
|
2681
|
+
:type keys: List[str]
|
|
2682
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
2683
|
+
number provided, it will be total request
|
|
2684
|
+
timeout. It can also be a pair (tuple) of
|
|
2685
|
+
(connection, read) timeouts.
|
|
2686
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
2687
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
2688
|
+
request; this effectively ignores the
|
|
2689
|
+
authentication in the spec for a single request.
|
|
2690
|
+
:type _request_auth: dict, optional
|
|
2691
|
+
:param _content_type: force content-type for the request.
|
|
2692
|
+
:type _content_type: str, Optional
|
|
2693
|
+
:param _headers: set to override the headers for a single
|
|
2694
|
+
request; this effectively ignores the headers
|
|
2695
|
+
in the spec for a single request.
|
|
2696
|
+
:type _headers: dict, optional
|
|
2697
|
+
:param _host_index: set to override the host_index for a single
|
|
2698
|
+
request; this effectively ignores the host_index
|
|
2699
|
+
in the spec for a single request.
|
|
2700
|
+
:type _host_index: int, optional
|
|
2701
|
+
:return: Returns the result object.
|
|
2702
|
+
""" # noqa: E501
|
|
2703
|
+
|
|
2704
|
+
_param = self._v1_event_list_serialize(
|
|
2705
|
+
tenant=tenant,
|
|
2706
|
+
offset=offset,
|
|
2707
|
+
limit=limit,
|
|
2708
|
+
keys=keys,
|
|
2709
|
+
_request_auth=_request_auth,
|
|
2710
|
+
_content_type=_content_type,
|
|
2711
|
+
_headers=_headers,
|
|
2712
|
+
_host_index=_host_index,
|
|
2713
|
+
)
|
|
2714
|
+
|
|
2715
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
2716
|
+
"200": "V1EventList",
|
|
2717
|
+
"400": "APIErrors",
|
|
2718
|
+
"403": "APIErrors",
|
|
2719
|
+
}
|
|
2720
|
+
response_data = self.api_client.call_api(
|
|
2721
|
+
*_param, _request_timeout=_request_timeout
|
|
2722
|
+
)
|
|
2723
|
+
response_data.read()
|
|
2724
|
+
return self.api_client.response_deserialize(
|
|
2725
|
+
response_data=response_data,
|
|
2726
|
+
response_types_map=_response_types_map,
|
|
2727
|
+
)
|
|
2728
|
+
|
|
2729
|
+
@validate_call
|
|
2730
|
+
def v1_event_list_without_preload_content(
|
|
2731
|
+
self,
|
|
2732
|
+
tenant: Annotated[
|
|
2733
|
+
str,
|
|
2734
|
+
Field(
|
|
2735
|
+
min_length=36, strict=True, max_length=36, description="The tenant id"
|
|
2736
|
+
),
|
|
2737
|
+
],
|
|
2738
|
+
offset: Annotated[
|
|
2739
|
+
Optional[StrictInt], Field(description="The number to skip")
|
|
2740
|
+
] = None,
|
|
2741
|
+
limit: Annotated[
|
|
2742
|
+
Optional[StrictInt], Field(description="The number to limit by")
|
|
2743
|
+
] = None,
|
|
2744
|
+
keys: Annotated[
|
|
2745
|
+
Optional[List[StrictStr]], Field(description="A list of keys to filter by")
|
|
2746
|
+
] = None,
|
|
2747
|
+
_request_timeout: Union[
|
|
2748
|
+
None,
|
|
2749
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
2750
|
+
Tuple[
|
|
2751
|
+
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
|
|
2752
|
+
],
|
|
2753
|
+
] = None,
|
|
2754
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
2755
|
+
_content_type: Optional[StrictStr] = None,
|
|
2756
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
2757
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
2758
|
+
) -> RESTResponseType:
|
|
2759
|
+
"""List events
|
|
2760
|
+
|
|
2761
|
+
Lists all events for a tenant.
|
|
2762
|
+
|
|
2763
|
+
:param tenant: The tenant id (required)
|
|
2764
|
+
:type tenant: str
|
|
2765
|
+
:param offset: The number to skip
|
|
2766
|
+
:type offset: int
|
|
2767
|
+
:param limit: The number to limit by
|
|
2768
|
+
:type limit: int
|
|
2769
|
+
:param keys: A list of keys to filter by
|
|
2770
|
+
:type keys: List[str]
|
|
2771
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
2772
|
+
number provided, it will be total request
|
|
2773
|
+
timeout. It can also be a pair (tuple) of
|
|
2774
|
+
(connection, read) timeouts.
|
|
2775
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
2776
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
2777
|
+
request; this effectively ignores the
|
|
2778
|
+
authentication in the spec for a single request.
|
|
2779
|
+
:type _request_auth: dict, optional
|
|
2780
|
+
:param _content_type: force content-type for the request.
|
|
2781
|
+
:type _content_type: str, Optional
|
|
2782
|
+
:param _headers: set to override the headers for a single
|
|
2783
|
+
request; this effectively ignores the headers
|
|
2784
|
+
in the spec for a single request.
|
|
2785
|
+
:type _headers: dict, optional
|
|
2786
|
+
:param _host_index: set to override the host_index for a single
|
|
2787
|
+
request; this effectively ignores the host_index
|
|
2788
|
+
in the spec for a single request.
|
|
2789
|
+
:type _host_index: int, optional
|
|
2790
|
+
:return: Returns the result object.
|
|
2791
|
+
""" # noqa: E501
|
|
2792
|
+
|
|
2793
|
+
_param = self._v1_event_list_serialize(
|
|
2794
|
+
tenant=tenant,
|
|
2795
|
+
offset=offset,
|
|
2796
|
+
limit=limit,
|
|
2797
|
+
keys=keys,
|
|
2798
|
+
_request_auth=_request_auth,
|
|
2799
|
+
_content_type=_content_type,
|
|
2800
|
+
_headers=_headers,
|
|
2801
|
+
_host_index=_host_index,
|
|
2802
|
+
)
|
|
2803
|
+
|
|
2804
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
2805
|
+
"200": "V1EventList",
|
|
2806
|
+
"400": "APIErrors",
|
|
2807
|
+
"403": "APIErrors",
|
|
2808
|
+
}
|
|
2809
|
+
response_data = self.api_client.call_api(
|
|
2810
|
+
*_param, _request_timeout=_request_timeout
|
|
2811
|
+
)
|
|
2812
|
+
return response_data.response
|
|
2813
|
+
|
|
2814
|
+
def _v1_event_list_serialize(
|
|
2815
|
+
self,
|
|
2816
|
+
tenant,
|
|
2817
|
+
offset,
|
|
2818
|
+
limit,
|
|
2819
|
+
keys,
|
|
2820
|
+
_request_auth,
|
|
2821
|
+
_content_type,
|
|
2822
|
+
_headers,
|
|
2823
|
+
_host_index,
|
|
2824
|
+
) -> RequestSerialized:
|
|
2825
|
+
|
|
2826
|
+
_host = None
|
|
2827
|
+
|
|
2828
|
+
_collection_formats: Dict[str, str] = {
|
|
2829
|
+
"keys": "multi",
|
|
2830
|
+
}
|
|
2831
|
+
|
|
2832
|
+
_path_params: Dict[str, str] = {}
|
|
2833
|
+
_query_params: List[Tuple[str, str]] = []
|
|
2834
|
+
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
2835
|
+
_form_params: List[Tuple[str, str]] = []
|
|
2836
|
+
_files: Dict[
|
|
2837
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
2838
|
+
] = {}
|
|
2839
|
+
_body_params: Optional[bytes] = None
|
|
2840
|
+
|
|
2841
|
+
# process the path parameters
|
|
2842
|
+
if tenant is not None:
|
|
2843
|
+
_path_params["tenant"] = tenant
|
|
2844
|
+
# process the query parameters
|
|
2845
|
+
if offset is not None:
|
|
2846
|
+
|
|
2847
|
+
_query_params.append(("offset", offset))
|
|
2848
|
+
|
|
2849
|
+
if limit is not None:
|
|
2850
|
+
|
|
2851
|
+
_query_params.append(("limit", limit))
|
|
2852
|
+
|
|
2853
|
+
if keys is not None:
|
|
2854
|
+
|
|
2855
|
+
_query_params.append(("keys", keys))
|
|
2856
|
+
|
|
2857
|
+
# process the header parameters
|
|
2858
|
+
# process the form parameters
|
|
2859
|
+
# process the body parameter
|
|
2860
|
+
|
|
2861
|
+
# set the HTTP header `Accept`
|
|
2862
|
+
if "Accept" not in _header_params:
|
|
2863
|
+
_header_params["Accept"] = self.api_client.select_header_accept(
|
|
2864
|
+
["application/json"]
|
|
2865
|
+
)
|
|
2866
|
+
|
|
2867
|
+
# authentication setting
|
|
2868
|
+
_auth_settings: List[str] = ["cookieAuth", "bearerAuth"]
|
|
2869
|
+
|
|
2870
|
+
return self.api_client.param_serialize(
|
|
2871
|
+
method="GET",
|
|
2872
|
+
resource_path="/api/v1/stable/tenants/{tenant}/events",
|
|
2873
|
+
path_params=_path_params,
|
|
2874
|
+
query_params=_query_params,
|
|
2875
|
+
header_params=_header_params,
|
|
2876
|
+
body=_body_params,
|
|
2877
|
+
post_params=_form_params,
|
|
2878
|
+
files=_files,
|
|
2879
|
+
auth_settings=_auth_settings,
|
|
2880
|
+
collection_formats=_collection_formats,
|
|
2881
|
+
_host=_host,
|
|
2882
|
+
_request_auth=_request_auth,
|
|
2883
|
+
)
|