volcano-sdk-python 0.9.4__py3-none-any.whl → 0.10.1__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.
Files changed (90) hide show
  1. volcano_sdk/__init__.py +8 -0
  2. volcano_sdk/_function_resolution.py +36 -3
  3. volcano_sdk/_generated/api/databases/list_database_regions.py +8 -0
  4. volcano_sdk/_generated/api/durable_functions/__init__.py +1 -0
  5. volcano_sdk/_generated/api/durable_functions/create_durable_function.py +295 -0
  6. volcano_sdk/_generated/api/durable_functions/create_durable_function_scheduler.py +259 -0
  7. volcano_sdk/_generated/api/durable_functions/delete_durable_function.py +213 -0
  8. volcano_sdk/_generated/api/durable_functions/delete_durable_function_scheduler.py +202 -0
  9. volcano_sdk/_generated/api/durable_functions/get_durable_execution.py +225 -0
  10. volcano_sdk/_generated/api/durable_functions/get_durable_function.py +193 -0
  11. volcano_sdk/_generated/api/durable_functions/get_durable_function_scheduler.py +206 -0
  12. volcano_sdk/_generated/api/durable_functions/list_durable_executions.py +318 -0
  13. volcano_sdk/_generated/api/durable_functions/list_durable_function_deployments.py +230 -0
  14. volcano_sdk/_generated/api/durable_functions/list_durable_function_schedulers.py +213 -0
  15. volcano_sdk/_generated/api/durable_functions/list_durable_functions.py +251 -0
  16. volcano_sdk/_generated/api/durable_functions/start_durable_execution.py +333 -0
  17. volcano_sdk/_generated/api/durable_functions/start_durable_execution_from_application.py +389 -0
  18. volcano_sdk/_generated/api/durable_functions/stop_durable_execution.py +268 -0
  19. volcano_sdk/_generated/api/durable_functions/update_durable_function_scheduler.py +233 -0
  20. volcano_sdk/_generated/api/frontends/create_frontend.py +4 -4
  21. volcano_sdk/_generated/api/functions/create_function_scheduler.py +14 -0
  22. volcano_sdk/_generated/api/functions/create_functions_batch.py +21 -0
  23. volcano_sdk/_generated/api/functions/delete_function_scheduler.py +79 -7
  24. volcano_sdk/_generated/api/functions/get_function_scheduler.py +18 -10
  25. volcano_sdk/_generated/api/functions/invoke_function.py +24 -0
  26. volcano_sdk/_generated/api/functions/list_function_schedulers.py +18 -10
  27. volcano_sdk/_generated/api/functions/update_function_scheduler.py +25 -10
  28. volcano_sdk/_generated/api/o_auth_authentication/call_o_auth_provider_api.py +12 -4
  29. volcano_sdk/_generated/api/projects/apply_project_config.py +7 -0
  30. volcano_sdk/_generated/api/projects/get_project_config.py +19 -8
  31. volcano_sdk/_generated/api/projects/get_project_logo.py +21 -10
  32. volcano_sdk/_generated/api/projects/replace_shared_variables.py +249 -0
  33. volcano_sdk/_generated/api/storage_objects/download_public_file.py +21 -10
  34. volcano_sdk/_generated/api/variables/create_variable.py +7 -0
  35. volcano_sdk/_generated/api/variables/update_variable.py +7 -0
  36. volcano_sdk/_generated/models/__init__.py +30 -2
  37. volcano_sdk/_generated/models/create_database_request.py +8 -9
  38. volcano_sdk/_generated/models/create_durable_function_body.py +223 -0
  39. volcano_sdk/_generated/models/create_durable_function_body_runtime.py +10 -0
  40. volcano_sdk/_generated/models/create_durable_function_body_variable_scope.py +10 -0
  41. volcano_sdk/_generated/models/create_function_body.py +50 -2
  42. volcano_sdk/_generated/models/create_function_body_variable_scope.py +10 -0
  43. volcano_sdk/_generated/models/create_functions_batch_body.py +11 -0
  44. volcano_sdk/_generated/models/create_variable_request.py +12 -0
  45. volcano_sdk/_generated/models/durable_execution.py +216 -0
  46. volcano_sdk/_generated/models/durable_execution_error.py +88 -0
  47. volcano_sdk/_generated/models/durable_execution_status.py +10 -0
  48. volcano_sdk/_generated/models/durable_function.py +290 -0
  49. volcano_sdk/_generated/models/durable_function_config.py +97 -0
  50. volcano_sdk/_generated/models/durable_function_status.py +10 -0
  51. volcano_sdk/_generated/models/function_kind.py +10 -0
  52. volcano_sdk/_generated/models/function_runtime_option.py +9 -0
  53. volcano_sdk/_generated/models/function_scheduler.py +26 -0
  54. volcano_sdk/_generated/models/list_database_regions_response_200_item.py +1 -1
  55. volcano_sdk/_generated/models/metric_usage_data.py +11 -2
  56. volcano_sdk/_generated/models/paginated_durable_executions.py +126 -0
  57. volcano_sdk/_generated/models/paginated_durable_functions.py +126 -0
  58. volcano_sdk/_generated/models/project_config.py +15 -0
  59. volcano_sdk/_generated/models/project_config_function.py +74 -1
  60. volcano_sdk/_generated/models/project_config_function_variable_scope.py +10 -0
  61. volcano_sdk/_generated/models/project_config_variable.py +12 -0
  62. volcano_sdk/_generated/models/project_deployment_resource.py +27 -0
  63. volcano_sdk/_generated/models/project_health_resource.py +27 -0
  64. volcano_sdk/_generated/models/replace_shared_variables_body.py +88 -0
  65. volcano_sdk/_generated/models/update_variable_request.py +12 -0
  66. volcano_sdk/_generated/models/variable.py +11 -0
  67. volcano_sdk/_lock_guard.py +10 -3
  68. volcano_sdk/_lock_renewer.py +9 -1
  69. volcano_sdk/_log_response.py +84 -0
  70. volcano_sdk/_realtime_fetch_worker.py +63 -35
  71. volcano_sdk/_session.py +39 -12
  72. volcano_sdk/_session_operations.py +9 -1
  73. volcano_sdk/_transport.py +108 -0
  74. volcano_sdk/auth.py +278 -67
  75. volcano_sdk/client.py +18 -6
  76. volcano_sdk/connection_string.py +15 -1
  77. volcano_sdk/database.py +189 -28
  78. volcano_sdk/durable.py +387 -0
  79. volcano_sdk/durable_authoring.py +919 -0
  80. volcano_sdk/functions.py +23 -4
  81. volcano_sdk/locks.py +35 -5
  82. volcano_sdk/logs.py +27 -36
  83. volcano_sdk/models.py +73 -0
  84. volcano_sdk/realtime.py +345 -167
  85. volcano_sdk/storage.py +87 -15
  86. {volcano_sdk_python-0.9.4.dist-info → volcano_sdk_python-0.10.1.dist-info}/METADATA +142 -11
  87. {volcano_sdk_python-0.9.4.dist-info → volcano_sdk_python-0.10.1.dist-info}/RECORD +89 -55
  88. {volcano_sdk_python-0.9.4.dist-info → volcano_sdk_python-0.10.1.dist-info}/WHEEL +1 -1
  89. volcano_sdk/_generated/models/create_database_request_region.py +0 -10
  90. {volcano_sdk_python-0.9.4.dist-info → volcano_sdk_python-0.10.1.dist-info}/licenses/LICENSE +0 -0
volcano_sdk/__init__.py CHANGED
@@ -19,6 +19,10 @@ from .models import (
19
19
  AuthSession,
20
20
  AuthStateCallback,
21
21
  AuthSubscription,
22
+ DurableExecution,
23
+ DurableExecutionFailure,
24
+ DurableExecutionPage,
25
+ DurableExecutionStatus,
22
26
  EmailChangeResult,
23
27
  FunctionResponse,
24
28
  LinkedOAuthProvider,
@@ -54,6 +58,10 @@ __all__ = [
54
58
  "AuthSubscription",
55
59
  "AuthenticationError",
56
60
  "ConflictError",
61
+ "DurableExecution",
62
+ "DurableExecutionFailure",
63
+ "DurableExecutionPage",
64
+ "DurableExecutionStatus",
57
65
  "EmailChangeResult",
58
66
  "FunctionResponse",
59
67
  "LinkedOAuthProvider",
@@ -28,7 +28,14 @@ _LOCK_STRIPES = 64
28
28
 
29
29
 
30
30
  def _now() -> float:
31
- """Read the clock lifetimes are measured against, immune to wall-clock jumps."""
31
+ """Read the clock used for cache lifetimes.
32
+
33
+ Returns
34
+ -------
35
+ float
36
+ Monotonic seconds, unaffected by wall-clock adjustments.
37
+
38
+ """
32
39
  return time.monotonic()
33
40
 
34
41
 
@@ -62,7 +69,14 @@ _stripes = [threading.Lock() for _ in range(_LOCK_STRIPES)]
62
69
 
63
70
 
64
71
  def resolve_lock(api_url: str, authorization: str, name: str) -> threading.Lock:
65
- """Return the lock that serializes resolving one name."""
72
+ """Select the lock for resolving one name.
73
+
74
+ Returns
75
+ -------
76
+ threading.Lock
77
+ A shared stripe keyed by API URL, credential, and function name.
78
+
79
+ """
66
80
  return _stripes[hash((api_url, authorization, name)) % _LOCK_STRIPES]
67
81
 
68
82
 
@@ -75,6 +89,12 @@ def valid_invoke_url(value: object, api_url: str) -> str | None:
75
89
 
76
90
  Anything unusable yields None so the caller falls back to the API path. A
77
91
  malformed server response must not raise out of invoke().
92
+
93
+ Returns
94
+ -------
95
+ str or None
96
+ The accepted URL unchanged, or None to use the API endpoint.
97
+
78
98
  """
79
99
  if not isinstance(value, str):
80
100
  return None
@@ -91,6 +111,12 @@ def _absolute_url_scheme(value: str) -> str:
91
111
 
92
112
  Unparseable input yields "" rather than raising, so a malformed URL reads
93
113
  as unusable to every caller.
114
+
115
+ Returns
116
+ -------
117
+ str
118
+ The lowercase scheme, or an empty string for an invalid authority or URL.
119
+
94
120
  """
95
121
  if not value or any(character.isspace() for character in value):
96
122
  return ""
@@ -105,7 +131,14 @@ def _absolute_url_scheme(value: str) -> str:
105
131
 
106
132
 
107
133
  def lookup(api_url: str, authorization: str, name: str) -> CachedOutcome | None:
108
- """Return the cached outcome for a name, or None when it must be resolved."""
134
+ """Look up a function within its API and credential scope.
135
+
136
+ Returns
137
+ -------
138
+ CachedOutcome or None
139
+ An unexpired resolution or remembered miss; None requires a new resolve.
140
+
141
+ """
109
142
  key = (api_url, authorization, name)
110
143
  now = _now()
111
144
  with _lock:
@@ -68,6 +68,8 @@ def sync_detailed(
68
68
  """ List platform-supported regions for database provisioning
69
69
 
70
70
  Returns the regions enabled for database provisioning in this platform environment.
71
+ These are the same regions offered for function deployment, and the only values
72
+ the `region` field of a database accepts.
71
73
  This is a public endpoint that doesn't require authentication.
72
74
 
73
75
  Raises:
@@ -97,6 +99,8 @@ def sync(
97
99
  """ List platform-supported regions for database provisioning
98
100
 
99
101
  Returns the regions enabled for database provisioning in this platform environment.
102
+ These are the same regions offered for function deployment, and the only values
103
+ the `region` field of a database accepts.
100
104
  This is a public endpoint that doesn't require authentication.
101
105
 
102
106
  Raises:
@@ -121,6 +125,8 @@ async def asyncio_detailed(
121
125
  """ List platform-supported regions for database provisioning
122
126
 
123
127
  Returns the regions enabled for database provisioning in this platform environment.
128
+ These are the same regions offered for function deployment, and the only values
129
+ the `region` field of a database accepts.
124
130
  This is a public endpoint that doesn't require authentication.
125
131
 
126
132
  Raises:
@@ -150,6 +156,8 @@ async def asyncio(
150
156
  """ List platform-supported regions for database provisioning
151
157
 
152
158
  Returns the regions enabled for database provisioning in this platform environment.
159
+ These are the same regions offered for function deployment, and the only values
160
+ the `region` field of a database accepts.
153
161
  This is a public endpoint that doesn't require authentication.
154
162
 
155
163
  Raises:
@@ -0,0 +1 @@
1
+ """ Contains endpoint functions for accessing the API """
@@ -0,0 +1,295 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, cast
3
+ from urllib.parse import quote
4
+
5
+ import httpx
6
+
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...types import Response, UNSET
9
+ from ... import errors
10
+
11
+ from ...models.create_durable_function_body import CreateDurableFunctionBody
12
+ from ...models.durable_function import DurableFunction
13
+ from ...models.error import Error
14
+ from typing import cast
15
+ from uuid import UUID
16
+
17
+
18
+
19
+ def _get_kwargs(
20
+ id: UUID,
21
+ *,
22
+ body: CreateDurableFunctionBody,
23
+
24
+ ) -> dict[str, Any]:
25
+ headers: dict[str, Any] = {}
26
+
27
+
28
+
29
+
30
+
31
+
32
+ _kwargs: dict[str, Any] = {
33
+ "method": "post",
34
+ "url": "/projects/{id}/durable-functions".format(id=quote(str(id), safe=""),),
35
+ }
36
+
37
+ _kwargs["files"] = body.to_multipart()
38
+
39
+ headers["Content-Type"] = "multipart/form-data; boundary=+++"
40
+
41
+ _kwargs["headers"] = headers
42
+ return _kwargs
43
+
44
+
45
+
46
+ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> DurableFunction | Error | None:
47
+ if response.status_code == 200:
48
+ response_200 = DurableFunction.from_dict(response.json())
49
+
50
+
51
+
52
+ return response_200
53
+
54
+ if response.status_code == 201:
55
+ response_201 = DurableFunction.from_dict(response.json())
56
+
57
+
58
+
59
+ return response_201
60
+
61
+ if response.status_code == 400:
62
+ response_400 = Error.from_dict(response.json())
63
+
64
+
65
+
66
+ return response_400
67
+
68
+ if response.status_code == 403:
69
+ response_403 = Error.from_dict(response.json())
70
+
71
+
72
+
73
+ return response_403
74
+
75
+ if response.status_code == 409:
76
+ response_409 = Error.from_dict(response.json())
77
+
78
+
79
+
80
+ return response_409
81
+
82
+ if response.status_code == 500:
83
+ response_500 = Error.from_dict(response.json())
84
+
85
+
86
+
87
+ return response_500
88
+
89
+ if response.status_code == 503:
90
+ response_503 = Error.from_dict(response.json())
91
+
92
+
93
+
94
+ return response_503
95
+
96
+ if client.raise_on_unexpected_status:
97
+ raise errors.UnexpectedStatus(response.status_code, response.content)
98
+ else:
99
+ return None
100
+
101
+
102
+ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[DurableFunction | Error]:
103
+ return Response(
104
+ status_code=HTTPStatus(response.status_code),
105
+ content=response.content,
106
+ headers=response.headers,
107
+ parsed=_parse_response(client=client, response=response),
108
+ )
109
+
110
+
111
+ def sync_detailed(
112
+ id: UUID,
113
+ *,
114
+ client: AuthenticatedClient,
115
+ body: CreateDurableFunctionBody,
116
+
117
+ ) -> Response[DurableFunction | Error]:
118
+ """ Create or update a durable function
119
+
120
+ Upload a durable function source bundle. Creates the function on the
121
+ first call for a name and redeploys it on every call after that, the
122
+ same create-or-update contract `POST /projects/{id}/functions` has.
123
+
124
+ Volcano builds and deploys asynchronously. A deployment that starts
125
+ immediately returns `status: provisioning`, then transitions to `active`
126
+ or `failed`; a deployment that has to wait for a running one is exposed
127
+ through `pending_deployment_id`. Existing executions keep running
128
+ against the runtime they started on.
129
+
130
+ The `durable` configuration is derived from the project's plan rather
131
+ than supplied here, and is fixed once the function exists. A name
132
+ already held by a standard function is rejected with 409: a function
133
+ cannot change kind.
134
+
135
+ Args:
136
+ id (UUID):
137
+ body (CreateDurableFunctionBody):
138
+
139
+ Raises:
140
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
141
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
142
+
143
+ Returns:
144
+ Response[DurableFunction | Error]
145
+ """
146
+
147
+
148
+ kwargs = _get_kwargs(
149
+ id=id,
150
+ body=body,
151
+
152
+ )
153
+
154
+ response = client.get_httpx_client().request(
155
+ **kwargs,
156
+ )
157
+
158
+ return _build_response(client=client, response=response)
159
+
160
+ def sync(
161
+ id: UUID,
162
+ *,
163
+ client: AuthenticatedClient,
164
+ body: CreateDurableFunctionBody,
165
+
166
+ ) -> DurableFunction | Error | None:
167
+ """ Create or update a durable function
168
+
169
+ Upload a durable function source bundle. Creates the function on the
170
+ first call for a name and redeploys it on every call after that, the
171
+ same create-or-update contract `POST /projects/{id}/functions` has.
172
+
173
+ Volcano builds and deploys asynchronously. A deployment that starts
174
+ immediately returns `status: provisioning`, then transitions to `active`
175
+ or `failed`; a deployment that has to wait for a running one is exposed
176
+ through `pending_deployment_id`. Existing executions keep running
177
+ against the runtime they started on.
178
+
179
+ The `durable` configuration is derived from the project's plan rather
180
+ than supplied here, and is fixed once the function exists. A name
181
+ already held by a standard function is rejected with 409: a function
182
+ cannot change kind.
183
+
184
+ Args:
185
+ id (UUID):
186
+ body (CreateDurableFunctionBody):
187
+
188
+ Raises:
189
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
190
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
191
+
192
+ Returns:
193
+ DurableFunction | Error
194
+ """
195
+
196
+
197
+ return sync_detailed(
198
+ id=id,
199
+ client=client,
200
+ body=body,
201
+
202
+ ).parsed
203
+
204
+ async def asyncio_detailed(
205
+ id: UUID,
206
+ *,
207
+ client: AuthenticatedClient,
208
+ body: CreateDurableFunctionBody,
209
+
210
+ ) -> Response[DurableFunction | Error]:
211
+ """ Create or update a durable function
212
+
213
+ Upload a durable function source bundle. Creates the function on the
214
+ first call for a name and redeploys it on every call after that, the
215
+ same create-or-update contract `POST /projects/{id}/functions` has.
216
+
217
+ Volcano builds and deploys asynchronously. A deployment that starts
218
+ immediately returns `status: provisioning`, then transitions to `active`
219
+ or `failed`; a deployment that has to wait for a running one is exposed
220
+ through `pending_deployment_id`. Existing executions keep running
221
+ against the runtime they started on.
222
+
223
+ The `durable` configuration is derived from the project's plan rather
224
+ than supplied here, and is fixed once the function exists. A name
225
+ already held by a standard function is rejected with 409: a function
226
+ cannot change kind.
227
+
228
+ Args:
229
+ id (UUID):
230
+ body (CreateDurableFunctionBody):
231
+
232
+ Raises:
233
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
234
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
235
+
236
+ Returns:
237
+ Response[DurableFunction | Error]
238
+ """
239
+
240
+
241
+ kwargs = _get_kwargs(
242
+ id=id,
243
+ body=body,
244
+
245
+ )
246
+
247
+ response = await client.get_async_httpx_client().request(
248
+ **kwargs
249
+ )
250
+
251
+ return _build_response(client=client, response=response)
252
+
253
+ async def asyncio(
254
+ id: UUID,
255
+ *,
256
+ client: AuthenticatedClient,
257
+ body: CreateDurableFunctionBody,
258
+
259
+ ) -> DurableFunction | Error | None:
260
+ """ Create or update a durable function
261
+
262
+ Upload a durable function source bundle. Creates the function on the
263
+ first call for a name and redeploys it on every call after that, the
264
+ same create-or-update contract `POST /projects/{id}/functions` has.
265
+
266
+ Volcano builds and deploys asynchronously. A deployment that starts
267
+ immediately returns `status: provisioning`, then transitions to `active`
268
+ or `failed`; a deployment that has to wait for a running one is exposed
269
+ through `pending_deployment_id`. Existing executions keep running
270
+ against the runtime they started on.
271
+
272
+ The `durable` configuration is derived from the project's plan rather
273
+ than supplied here, and is fixed once the function exists. A name
274
+ already held by a standard function is rejected with 409: a function
275
+ cannot change kind.
276
+
277
+ Args:
278
+ id (UUID):
279
+ body (CreateDurableFunctionBody):
280
+
281
+ Raises:
282
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
283
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
284
+
285
+ Returns:
286
+ DurableFunction | Error
287
+ """
288
+
289
+
290
+ return (await asyncio_detailed(
291
+ id=id,
292
+ client=client,
293
+ body=body,
294
+
295
+ )).parsed
@@ -0,0 +1,259 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, cast
3
+ from urllib.parse import quote
4
+
5
+ import httpx
6
+
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...types import Response, UNSET
9
+ from ... import errors
10
+
11
+ from ...models.create_function_scheduler_request import CreateFunctionSchedulerRequest
12
+ from ...models.error import Error
13
+ from ...models.function_scheduler import FunctionScheduler
14
+ from typing import cast
15
+ from uuid import UUID
16
+
17
+
18
+
19
+ def _get_kwargs(
20
+ id: UUID,
21
+ function_id: str,
22
+ *,
23
+ body: CreateFunctionSchedulerRequest,
24
+
25
+ ) -> dict[str, Any]:
26
+ headers: dict[str, Any] = {}
27
+
28
+
29
+
30
+
31
+
32
+
33
+ _kwargs: dict[str, Any] = {
34
+ "method": "post",
35
+ "url": "/projects/{id}/durable-functions/{function_id}/schedulers".format(id=quote(str(id), safe=""),function_id=quote(str(function_id), safe=""),),
36
+ }
37
+
38
+ _kwargs["json"] = body.to_dict()
39
+
40
+ headers["Content-Type"] = "application/json"
41
+
42
+ _kwargs["headers"] = headers
43
+ return _kwargs
44
+
45
+
46
+
47
+ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Error | FunctionScheduler | None:
48
+ if response.status_code == 201:
49
+ response_201 = FunctionScheduler.from_dict(response.json())
50
+
51
+
52
+
53
+ return response_201
54
+
55
+ if response.status_code == 400:
56
+ response_400 = Error.from_dict(response.json())
57
+
58
+
59
+
60
+ return response_400
61
+
62
+ if response.status_code == 403:
63
+ response_403 = Error.from_dict(response.json())
64
+
65
+
66
+
67
+ return response_403
68
+
69
+ if response.status_code == 404:
70
+ response_404 = Error.from_dict(response.json())
71
+
72
+
73
+
74
+ return response_404
75
+
76
+ if client.raise_on_unexpected_status:
77
+ raise errors.UnexpectedStatus(response.status_code, response.content)
78
+ else:
79
+ return None
80
+
81
+
82
+ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Error | FunctionScheduler]:
83
+ return Response(
84
+ status_code=HTTPStatus(response.status_code),
85
+ content=response.content,
86
+ headers=response.headers,
87
+ parsed=_parse_response(client=client, response=response),
88
+ )
89
+
90
+
91
+ def sync_detailed(
92
+ id: UUID,
93
+ function_id: str,
94
+ *,
95
+ client: AuthenticatedClient,
96
+ body: CreateFunctionSchedulerRequest,
97
+
98
+ ) -> Response[Error | FunctionScheduler]:
99
+ """ Create a scheduler for a durable function
100
+
101
+ Each tick starts an execution rather than invoking the function, under
102
+ an execution name derived from the run, so a retried tick resolves to
103
+ the execution it already started. Requested regions must be a subset of
104
+ the function's deployed regions.
105
+
106
+ A tick draws on the same durable allowances and concurrency cap a
107
+ manual start does, and a tick that would exceed the cap fails that run.
108
+
109
+ Args:
110
+ id (UUID):
111
+ function_id (str):
112
+ body (CreateFunctionSchedulerRequest):
113
+
114
+ Raises:
115
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
116
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
117
+
118
+ Returns:
119
+ Response[Error | FunctionScheduler]
120
+ """
121
+
122
+
123
+ kwargs = _get_kwargs(
124
+ id=id,
125
+ function_id=function_id,
126
+ body=body,
127
+
128
+ )
129
+
130
+ response = client.get_httpx_client().request(
131
+ **kwargs,
132
+ )
133
+
134
+ return _build_response(client=client, response=response)
135
+
136
+ def sync(
137
+ id: UUID,
138
+ function_id: str,
139
+ *,
140
+ client: AuthenticatedClient,
141
+ body: CreateFunctionSchedulerRequest,
142
+
143
+ ) -> Error | FunctionScheduler | None:
144
+ """ Create a scheduler for a durable function
145
+
146
+ Each tick starts an execution rather than invoking the function, under
147
+ an execution name derived from the run, so a retried tick resolves to
148
+ the execution it already started. Requested regions must be a subset of
149
+ the function's deployed regions.
150
+
151
+ A tick draws on the same durable allowances and concurrency cap a
152
+ manual start does, and a tick that would exceed the cap fails that run.
153
+
154
+ Args:
155
+ id (UUID):
156
+ function_id (str):
157
+ body (CreateFunctionSchedulerRequest):
158
+
159
+ Raises:
160
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
161
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
162
+
163
+ Returns:
164
+ Error | FunctionScheduler
165
+ """
166
+
167
+
168
+ return sync_detailed(
169
+ id=id,
170
+ function_id=function_id,
171
+ client=client,
172
+ body=body,
173
+
174
+ ).parsed
175
+
176
+ async def asyncio_detailed(
177
+ id: UUID,
178
+ function_id: str,
179
+ *,
180
+ client: AuthenticatedClient,
181
+ body: CreateFunctionSchedulerRequest,
182
+
183
+ ) -> Response[Error | FunctionScheduler]:
184
+ """ Create a scheduler for a durable function
185
+
186
+ Each tick starts an execution rather than invoking the function, under
187
+ an execution name derived from the run, so a retried tick resolves to
188
+ the execution it already started. Requested regions must be a subset of
189
+ the function's deployed regions.
190
+
191
+ A tick draws on the same durable allowances and concurrency cap a
192
+ manual start does, and a tick that would exceed the cap fails that run.
193
+
194
+ Args:
195
+ id (UUID):
196
+ function_id (str):
197
+ body (CreateFunctionSchedulerRequest):
198
+
199
+ Raises:
200
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
201
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
202
+
203
+ Returns:
204
+ Response[Error | FunctionScheduler]
205
+ """
206
+
207
+
208
+ kwargs = _get_kwargs(
209
+ id=id,
210
+ function_id=function_id,
211
+ body=body,
212
+
213
+ )
214
+
215
+ response = await client.get_async_httpx_client().request(
216
+ **kwargs
217
+ )
218
+
219
+ return _build_response(client=client, response=response)
220
+
221
+ async def asyncio(
222
+ id: UUID,
223
+ function_id: str,
224
+ *,
225
+ client: AuthenticatedClient,
226
+ body: CreateFunctionSchedulerRequest,
227
+
228
+ ) -> Error | FunctionScheduler | None:
229
+ """ Create a scheduler for a durable function
230
+
231
+ Each tick starts an execution rather than invoking the function, under
232
+ an execution name derived from the run, so a retried tick resolves to
233
+ the execution it already started. Requested regions must be a subset of
234
+ the function's deployed regions.
235
+
236
+ A tick draws on the same durable allowances and concurrency cap a
237
+ manual start does, and a tick that would exceed the cap fails that run.
238
+
239
+ Args:
240
+ id (UUID):
241
+ function_id (str):
242
+ body (CreateFunctionSchedulerRequest):
243
+
244
+ Raises:
245
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
246
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
247
+
248
+ Returns:
249
+ Error | FunctionScheduler
250
+ """
251
+
252
+
253
+ return (await asyncio_detailed(
254
+ id=id,
255
+ function_id=function_id,
256
+ client=client,
257
+ body=body,
258
+
259
+ )).parsed