fourtheorem-tempo-client 0.0.1__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.
- fourtheorem_tempo_client-0.0.1/PKG-INFO +64 -0
- fourtheorem_tempo_client-0.0.1/README.md +54 -0
- fourtheorem_tempo_client-0.0.1/pyproject.toml +25 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/__init__.py +8 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/api/__init__.py +1 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/api/public/__init__.py +1 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/api/public/cancel_workload.py +180 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/api/public/create_registry_upload.py +189 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/api/public/create_workload_upload.py +205 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/api/public/delete_workload.py +180 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/api/public/get_job_attempt.py +219 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/api/public/get_workload_lifecycle.py +175 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/api/public/get_workload_status.py +175 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/api/public/health_check.py +132 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/api/public/list_job_attempts.py +199 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/api/public/list_jobs.py +196 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/api/public/list_resource_classes.py +153 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/api/public/list_workloads.py +141 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/api/public/submit_workload.py +200 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/client.py +268 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/errors.py +16 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/__init__.py +71 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/cancel_workload_response_cancel_workload.py +47 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/code_registry_entry_submission.py +154 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/delete_workload_response_delete_workload.py +47 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/error_response.py +104 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/health_response.py +62 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/http_validation_error.py +79 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/job_attempt_error_response.py +78 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/job_attempt_response.py +234 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/job_attempt_response_params.py +47 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/job_attempt_summary.py +194 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/job_attempts_response.py +76 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/job_submission.py +194 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/job_submission_inputs.py +47 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/job_submission_outputs.py +47 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/job_submission_params.py +47 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/jobs_response.py +76 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/lifecycle_audit_entry_response.py +150 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/lifecycle_audit_entry_response_details.py +47 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/lifecycle_audit_response.py +76 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/registry_upload_request.py +112 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/registry_upload_response.py +108 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/registry_upload_response_headers.py +47 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/resource_class_response.py +137 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/status_event_response.py +102 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/submit_response.py +70 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/validation_error.py +123 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/validation_error_context.py +47 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/workload_status_response.py +178 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/workload_submission.py +182 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/workload_submission_registry.py +60 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/workload_upload_request.py +74 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/workload_upload_response.py +112 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/models/workload_upload_response_headers.py +47 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/py.typed +1 -0
- fourtheorem_tempo_client-0.0.1/tempo_client/types.py +54 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: fourtheorem-tempo-client
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A client library for accessing Tempo API
|
|
5
|
+
Author: fourTheorem
|
|
6
|
+
Requires-Dist: httpx>=0.23.1,<0.29.0
|
|
7
|
+
Requires-Dist: attrs>=22.2.0
|
|
8
|
+
Requires-Python: >=3.11
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
|
|
11
|
+
# fourtheorem-tempo-client
|
|
12
|
+
|
|
13
|
+
Python client for the [Tempo](https://github.com/fourTheorem/tempo) public API, generated from its OpenAPI specification. Tempo is a high-throughput compute platform for massive-scale modelling workloads.
|
|
14
|
+
|
|
15
|
+
> **Status: early development.** The API surface is small and evolving, and authentication is not implemented yet — use `Client`; the generated `AuthenticatedClient` is boilerplate for a Bearer scheme the API does not support yet. Expect breaking changes until 1.0.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install fourtheorem-tempo-client
|
|
21
|
+
# or
|
|
22
|
+
uv add fourtheorem-tempo-client
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Requires Python 3.11+. Fully typed (`py.typed`); httpx-based, with sync and async variants for every operation.
|
|
26
|
+
|
|
27
|
+
## Quickstart
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from tempo_client import Client
|
|
31
|
+
from tempo_client.api.public import get_workload_status, health_check, submit_workload
|
|
32
|
+
from tempo_client.models import WorkloadSubmission
|
|
33
|
+
|
|
34
|
+
client = Client(base_url="https://your-tempo-host/api")
|
|
35
|
+
|
|
36
|
+
health_check.sync(client=client)
|
|
37
|
+
|
|
38
|
+
submitted = submit_workload.sync(
|
|
39
|
+
client=client,
|
|
40
|
+
body=WorkloadSubmission.from_dict(
|
|
41
|
+
{
|
|
42
|
+
"name": "demo",
|
|
43
|
+
"jobs": [{"id": "j-1", "name": "Job 1", "work_type": "default", "predecessors": []}],
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
status = get_workload_status.sync(client=client, workload_id=submitted.workload_id)
|
|
49
|
+
print(status.state)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Every operation also has an async variant:
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
status = await get_workload_status.asyncio(client=client, workload_id=submitted.workload_id)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## What's covered
|
|
59
|
+
|
|
60
|
+
Workload submission (inline or via presigned uploads for large job graphs), workload lifecycle (status, cancel, delete, audit trail), job and attempt inspection, the resource-class catalog, and worker-artifact registry uploads — the full public API surface.
|
|
61
|
+
|
|
62
|
+
## Documentation
|
|
63
|
+
|
|
64
|
+
The API reference (Scalar, with try-it-out) and narrative guides are served by your Tempo deployment at `/docs/`. The client is regenerated from the spec on every API change; see the [repository](https://github.com/fourTheorem/tempo/tree/main/sdks) for how the SDKs are produced.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# fourtheorem-tempo-client
|
|
2
|
+
|
|
3
|
+
Python client for the [Tempo](https://github.com/fourTheorem/tempo) public API, generated from its OpenAPI specification. Tempo is a high-throughput compute platform for massive-scale modelling workloads.
|
|
4
|
+
|
|
5
|
+
> **Status: early development.** The API surface is small and evolving, and authentication is not implemented yet — use `Client`; the generated `AuthenticatedClient` is boilerplate for a Bearer scheme the API does not support yet. Expect breaking changes until 1.0.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install fourtheorem-tempo-client
|
|
11
|
+
# or
|
|
12
|
+
uv add fourtheorem-tempo-client
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Requires Python 3.11+. Fully typed (`py.typed`); httpx-based, with sync and async variants for every operation.
|
|
16
|
+
|
|
17
|
+
## Quickstart
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from tempo_client import Client
|
|
21
|
+
from tempo_client.api.public import get_workload_status, health_check, submit_workload
|
|
22
|
+
from tempo_client.models import WorkloadSubmission
|
|
23
|
+
|
|
24
|
+
client = Client(base_url="https://your-tempo-host/api")
|
|
25
|
+
|
|
26
|
+
health_check.sync(client=client)
|
|
27
|
+
|
|
28
|
+
submitted = submit_workload.sync(
|
|
29
|
+
client=client,
|
|
30
|
+
body=WorkloadSubmission.from_dict(
|
|
31
|
+
{
|
|
32
|
+
"name": "demo",
|
|
33
|
+
"jobs": [{"id": "j-1", "name": "Job 1", "work_type": "default", "predecessors": []}],
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
status = get_workload_status.sync(client=client, workload_id=submitted.workload_id)
|
|
39
|
+
print(status.state)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Every operation also has an async variant:
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
status = await get_workload_status.asyncio(client=client, workload_id=submitted.workload_id)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## What's covered
|
|
49
|
+
|
|
50
|
+
Workload submission (inline or via presigned uploads for large job graphs), workload lifecycle (status, cancel, delete, audit trail), job and attempt inspection, the resource-class catalog, and worker-artifact registry uploads — the full public API surface.
|
|
51
|
+
|
|
52
|
+
## Documentation
|
|
53
|
+
|
|
54
|
+
The API reference (Scalar, with try-it-out) and narrative guides are served by your Tempo deployment at `/docs/`. The client is regenerated from the spec on every API change; see the [repository](https://github.com/fourTheorem/tempo/tree/main/sdks) for how the SDKs are produced.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "fourtheorem-tempo-client"
|
|
3
|
+
version = "0.0.1"
|
|
4
|
+
description = "A client library for accessing Tempo API"
|
|
5
|
+
authors = [{ name = "fourTheorem" }]
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
dependencies = [
|
|
9
|
+
"httpx>=0.23.1,<0.29.0",
|
|
10
|
+
"attrs>=22.2.0",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
[tool.uv.build-backend]
|
|
14
|
+
module-name = "tempo_client"
|
|
15
|
+
module-root = ""
|
|
16
|
+
|
|
17
|
+
[build-system]
|
|
18
|
+
requires = ["uv_build>=0.11.0,<0.12.0"]
|
|
19
|
+
build-backend = "uv_build"
|
|
20
|
+
|
|
21
|
+
[tool.ruff]
|
|
22
|
+
line-length = 120
|
|
23
|
+
|
|
24
|
+
[tool.ruff.lint]
|
|
25
|
+
select = ["F", "I", "UP"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains methods for accessing the API"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.cancel_workload_response_cancel_workload import CancelWorkloadResponseCancelWorkload
|
|
10
|
+
from ...models.error_response import ErrorResponse
|
|
11
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
12
|
+
from ...types import Response
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
workload_id: str,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
|
|
19
|
+
_kwargs: dict[str, Any] = {
|
|
20
|
+
"method": "post",
|
|
21
|
+
"url": "/workloads/{workload_id}/cancel".format(
|
|
22
|
+
workload_id=quote(str(workload_id), safe=""),
|
|
23
|
+
),
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return _kwargs
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _parse_response(
|
|
30
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
31
|
+
) -> CancelWorkloadResponseCancelWorkload | ErrorResponse | HTTPValidationError | None:
|
|
32
|
+
if response.status_code == 200:
|
|
33
|
+
response_200 = CancelWorkloadResponseCancelWorkload.from_dict(response.json())
|
|
34
|
+
|
|
35
|
+
return response_200
|
|
36
|
+
|
|
37
|
+
if response.status_code == 404:
|
|
38
|
+
response_404 = ErrorResponse.from_dict(response.json())
|
|
39
|
+
|
|
40
|
+
return response_404
|
|
41
|
+
|
|
42
|
+
if response.status_code == 409:
|
|
43
|
+
response_409 = ErrorResponse.from_dict(response.json())
|
|
44
|
+
|
|
45
|
+
return response_409
|
|
46
|
+
|
|
47
|
+
if response.status_code == 422:
|
|
48
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
49
|
+
|
|
50
|
+
return response_422
|
|
51
|
+
|
|
52
|
+
if client.raise_on_unexpected_status:
|
|
53
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
54
|
+
else:
|
|
55
|
+
return None
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _build_response(
|
|
59
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
60
|
+
) -> Response[CancelWorkloadResponseCancelWorkload | ErrorResponse | HTTPValidationError]:
|
|
61
|
+
return Response(
|
|
62
|
+
status_code=HTTPStatus(response.status_code),
|
|
63
|
+
content=response.content,
|
|
64
|
+
headers=response.headers,
|
|
65
|
+
parsed=_parse_response(client=client, response=response),
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def sync_detailed(
|
|
70
|
+
workload_id: str,
|
|
71
|
+
*,
|
|
72
|
+
client: AuthenticatedClient | Client,
|
|
73
|
+
) -> Response[CancelWorkloadResponseCancelWorkload | ErrorResponse | HTTPValidationError]:
|
|
74
|
+
"""Cancel Workload
|
|
75
|
+
|
|
76
|
+
Cancel a running workload.
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
workload_id (str):
|
|
80
|
+
|
|
81
|
+
Raises:
|
|
82
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
83
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
Response[CancelWorkloadResponseCancelWorkload | ErrorResponse | HTTPValidationError]
|
|
87
|
+
"""
|
|
88
|
+
|
|
89
|
+
kwargs = _get_kwargs(
|
|
90
|
+
workload_id=workload_id,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
response = client.get_httpx_client().request(
|
|
94
|
+
**kwargs,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
return _build_response(client=client, response=response)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def sync(
|
|
101
|
+
workload_id: str,
|
|
102
|
+
*,
|
|
103
|
+
client: AuthenticatedClient | Client,
|
|
104
|
+
) -> CancelWorkloadResponseCancelWorkload | ErrorResponse | HTTPValidationError | None:
|
|
105
|
+
"""Cancel Workload
|
|
106
|
+
|
|
107
|
+
Cancel a running workload.
|
|
108
|
+
|
|
109
|
+
Args:
|
|
110
|
+
workload_id (str):
|
|
111
|
+
|
|
112
|
+
Raises:
|
|
113
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
114
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
115
|
+
|
|
116
|
+
Returns:
|
|
117
|
+
CancelWorkloadResponseCancelWorkload | ErrorResponse | HTTPValidationError
|
|
118
|
+
"""
|
|
119
|
+
|
|
120
|
+
return sync_detailed(
|
|
121
|
+
workload_id=workload_id,
|
|
122
|
+
client=client,
|
|
123
|
+
).parsed
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
async def asyncio_detailed(
|
|
127
|
+
workload_id: str,
|
|
128
|
+
*,
|
|
129
|
+
client: AuthenticatedClient | Client,
|
|
130
|
+
) -> Response[CancelWorkloadResponseCancelWorkload | ErrorResponse | HTTPValidationError]:
|
|
131
|
+
"""Cancel Workload
|
|
132
|
+
|
|
133
|
+
Cancel a running workload.
|
|
134
|
+
|
|
135
|
+
Args:
|
|
136
|
+
workload_id (str):
|
|
137
|
+
|
|
138
|
+
Raises:
|
|
139
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
140
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
141
|
+
|
|
142
|
+
Returns:
|
|
143
|
+
Response[CancelWorkloadResponseCancelWorkload | ErrorResponse | HTTPValidationError]
|
|
144
|
+
"""
|
|
145
|
+
|
|
146
|
+
kwargs = _get_kwargs(
|
|
147
|
+
workload_id=workload_id,
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
151
|
+
|
|
152
|
+
return _build_response(client=client, response=response)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
async def asyncio(
|
|
156
|
+
workload_id: str,
|
|
157
|
+
*,
|
|
158
|
+
client: AuthenticatedClient | Client,
|
|
159
|
+
) -> CancelWorkloadResponseCancelWorkload | ErrorResponse | HTTPValidationError | None:
|
|
160
|
+
"""Cancel Workload
|
|
161
|
+
|
|
162
|
+
Cancel a running workload.
|
|
163
|
+
|
|
164
|
+
Args:
|
|
165
|
+
workload_id (str):
|
|
166
|
+
|
|
167
|
+
Raises:
|
|
168
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
169
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
170
|
+
|
|
171
|
+
Returns:
|
|
172
|
+
CancelWorkloadResponseCancelWorkload | ErrorResponse | HTTPValidationError
|
|
173
|
+
"""
|
|
174
|
+
|
|
175
|
+
return (
|
|
176
|
+
await asyncio_detailed(
|
|
177
|
+
workload_id=workload_id,
|
|
178
|
+
client=client,
|
|
179
|
+
)
|
|
180
|
+
).parsed
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.error_response import ErrorResponse
|
|
9
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
10
|
+
from ...models.registry_upload_request import RegistryUploadRequest
|
|
11
|
+
from ...models.registry_upload_response import RegistryUploadResponse
|
|
12
|
+
from ...types import Response
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
*,
|
|
17
|
+
body: RegistryUploadRequest,
|
|
18
|
+
) -> dict[str, Any]:
|
|
19
|
+
headers: dict[str, Any] = {}
|
|
20
|
+
|
|
21
|
+
_kwargs: dict[str, Any] = {
|
|
22
|
+
"method": "post",
|
|
23
|
+
"url": "/registry/uploads",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
_kwargs["json"] = body.to_dict()
|
|
27
|
+
|
|
28
|
+
headers["Content-Type"] = "application/json"
|
|
29
|
+
|
|
30
|
+
_kwargs["headers"] = headers
|
|
31
|
+
return _kwargs
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _parse_response(
|
|
35
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
36
|
+
) -> ErrorResponse | HTTPValidationError | RegistryUploadResponse | None:
|
|
37
|
+
if response.status_code == 201:
|
|
38
|
+
response_201 = RegistryUploadResponse.from_dict(response.json())
|
|
39
|
+
|
|
40
|
+
return response_201
|
|
41
|
+
|
|
42
|
+
if response.status_code == 400:
|
|
43
|
+
response_400 = ErrorResponse.from_dict(response.json())
|
|
44
|
+
|
|
45
|
+
return response_400
|
|
46
|
+
|
|
47
|
+
if response.status_code == 422:
|
|
48
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
49
|
+
|
|
50
|
+
return response_422
|
|
51
|
+
|
|
52
|
+
if response.status_code == 503:
|
|
53
|
+
response_503 = ErrorResponse.from_dict(response.json())
|
|
54
|
+
|
|
55
|
+
return response_503
|
|
56
|
+
|
|
57
|
+
if client.raise_on_unexpected_status:
|
|
58
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
59
|
+
else:
|
|
60
|
+
return None
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _build_response(
|
|
64
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
65
|
+
) -> Response[ErrorResponse | HTTPValidationError | RegistryUploadResponse]:
|
|
66
|
+
return Response(
|
|
67
|
+
status_code=HTTPStatus(response.status_code),
|
|
68
|
+
content=response.content,
|
|
69
|
+
headers=response.headers,
|
|
70
|
+
parsed=_parse_response(client=client, response=response),
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def sync_detailed(
|
|
75
|
+
*,
|
|
76
|
+
client: AuthenticatedClient | Client,
|
|
77
|
+
body: RegistryUploadRequest,
|
|
78
|
+
) -> Response[ErrorResponse | HTTPValidationError | RegistryUploadResponse]:
|
|
79
|
+
"""Create Registry Upload
|
|
80
|
+
|
|
81
|
+
Create a presigned upload URL for a dynamic worker ZIP artifact.
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
body (RegistryUploadRequest): Request body for creating a presigned code registry ZIP
|
|
85
|
+
upload.
|
|
86
|
+
|
|
87
|
+
Raises:
|
|
88
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
89
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
Response[ErrorResponse | HTTPValidationError | RegistryUploadResponse]
|
|
93
|
+
"""
|
|
94
|
+
|
|
95
|
+
kwargs = _get_kwargs(
|
|
96
|
+
body=body,
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
response = client.get_httpx_client().request(
|
|
100
|
+
**kwargs,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
return _build_response(client=client, response=response)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def sync(
|
|
107
|
+
*,
|
|
108
|
+
client: AuthenticatedClient | Client,
|
|
109
|
+
body: RegistryUploadRequest,
|
|
110
|
+
) -> ErrorResponse | HTTPValidationError | RegistryUploadResponse | None:
|
|
111
|
+
"""Create Registry Upload
|
|
112
|
+
|
|
113
|
+
Create a presigned upload URL for a dynamic worker ZIP artifact.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
body (RegistryUploadRequest): Request body for creating a presigned code registry ZIP
|
|
117
|
+
upload.
|
|
118
|
+
|
|
119
|
+
Raises:
|
|
120
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
121
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
122
|
+
|
|
123
|
+
Returns:
|
|
124
|
+
ErrorResponse | HTTPValidationError | RegistryUploadResponse
|
|
125
|
+
"""
|
|
126
|
+
|
|
127
|
+
return sync_detailed(
|
|
128
|
+
client=client,
|
|
129
|
+
body=body,
|
|
130
|
+
).parsed
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
async def asyncio_detailed(
|
|
134
|
+
*,
|
|
135
|
+
client: AuthenticatedClient | Client,
|
|
136
|
+
body: RegistryUploadRequest,
|
|
137
|
+
) -> Response[ErrorResponse | HTTPValidationError | RegistryUploadResponse]:
|
|
138
|
+
"""Create Registry Upload
|
|
139
|
+
|
|
140
|
+
Create a presigned upload URL for a dynamic worker ZIP artifact.
|
|
141
|
+
|
|
142
|
+
Args:
|
|
143
|
+
body (RegistryUploadRequest): Request body for creating a presigned code registry ZIP
|
|
144
|
+
upload.
|
|
145
|
+
|
|
146
|
+
Raises:
|
|
147
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
148
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
Response[ErrorResponse | HTTPValidationError | RegistryUploadResponse]
|
|
152
|
+
"""
|
|
153
|
+
|
|
154
|
+
kwargs = _get_kwargs(
|
|
155
|
+
body=body,
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
159
|
+
|
|
160
|
+
return _build_response(client=client, response=response)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
async def asyncio(
|
|
164
|
+
*,
|
|
165
|
+
client: AuthenticatedClient | Client,
|
|
166
|
+
body: RegistryUploadRequest,
|
|
167
|
+
) -> ErrorResponse | HTTPValidationError | RegistryUploadResponse | None:
|
|
168
|
+
"""Create Registry Upload
|
|
169
|
+
|
|
170
|
+
Create a presigned upload URL for a dynamic worker ZIP artifact.
|
|
171
|
+
|
|
172
|
+
Args:
|
|
173
|
+
body (RegistryUploadRequest): Request body for creating a presigned code registry ZIP
|
|
174
|
+
upload.
|
|
175
|
+
|
|
176
|
+
Raises:
|
|
177
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
178
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
179
|
+
|
|
180
|
+
Returns:
|
|
181
|
+
ErrorResponse | HTTPValidationError | RegistryUploadResponse
|
|
182
|
+
"""
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
await asyncio_detailed(
|
|
186
|
+
client=client,
|
|
187
|
+
body=body,
|
|
188
|
+
)
|
|
189
|
+
).parsed
|