scale-gp-beta 0.1.0a40__py3-none-any.whl → 0.1.0a42__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.
- scale_gp_beta/_base_client.py +134 -11
- scale_gp_beta/_client.py +42 -0
- scale_gp_beta/_models.py +16 -1
- scale_gp_beta/_streaming.py +4 -2
- scale_gp_beta/_types.py +9 -0
- scale_gp_beta/_version.py +1 -1
- scale_gp_beta/resources/__init__.py +14 -0
- scale_gp_beta/resources/build.py +588 -0
- scale_gp_beta/types/__init__.py +7 -0
- scale_gp_beta/types/build_cancel_response.py +38 -0
- scale_gp_beta/types/build_create_params.py +26 -0
- scale_gp_beta/types/build_create_response.py +38 -0
- scale_gp_beta/types/build_list_params.py +19 -0
- scale_gp_beta/types/build_list_response.py +38 -0
- scale_gp_beta/types/build_retrieve_response.py +38 -0
- scale_gp_beta/types/stream_chunk.py +12 -0
- {scale_gp_beta-0.1.0a40.dist-info → scale_gp_beta-0.1.0a42.dist-info}/METADATA +50 -3
- {scale_gp_beta-0.1.0a40.dist-info → scale_gp_beta-0.1.0a42.dist-info}/RECORD +20 -12
- {scale_gp_beta-0.1.0a40.dist-info → scale_gp_beta-0.1.0a42.dist-info}/licenses/LICENSE +1 -1
- {scale_gp_beta-0.1.0a40.dist-info → scale_gp_beta-0.1.0a42.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Mapping, cast
|
|
6
|
+
from typing_extensions import Literal
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
from ..types import build_list_params, build_create_params
|
|
11
|
+
from .._types import Body, Omit, Query, Headers, NotGiven, FileTypes, omit, not_given
|
|
12
|
+
from .._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform
|
|
13
|
+
from .._compat import cached_property
|
|
14
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
15
|
+
from .._response import (
|
|
16
|
+
to_raw_response_wrapper,
|
|
17
|
+
to_streamed_response_wrapper,
|
|
18
|
+
async_to_raw_response_wrapper,
|
|
19
|
+
async_to_streamed_response_wrapper,
|
|
20
|
+
)
|
|
21
|
+
from .._streaming import Stream, AsyncStream
|
|
22
|
+
from ..pagination import SyncCursorPage, AsyncCursorPage
|
|
23
|
+
from .._base_client import AsyncPaginator, make_request_options
|
|
24
|
+
from ..types.stream_chunk import StreamChunk
|
|
25
|
+
from ..types.build_list_response import BuildListResponse
|
|
26
|
+
from ..types.build_cancel_response import BuildCancelResponse
|
|
27
|
+
from ..types.build_create_response import BuildCreateResponse
|
|
28
|
+
from ..types.build_retrieve_response import BuildRetrieveResponse
|
|
29
|
+
|
|
30
|
+
__all__ = ["BuildResource", "AsyncBuildResource"]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class BuildResource(SyncAPIResource):
|
|
34
|
+
@cached_property
|
|
35
|
+
def with_raw_response(self) -> BuildResourceWithRawResponse:
|
|
36
|
+
"""
|
|
37
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
38
|
+
the raw response object instead of the parsed content.
|
|
39
|
+
|
|
40
|
+
For more information, see https://www.github.com/scaleapi/sgp-python-beta#accessing-raw-response-data-eg-headers
|
|
41
|
+
"""
|
|
42
|
+
return BuildResourceWithRawResponse(self)
|
|
43
|
+
|
|
44
|
+
@cached_property
|
|
45
|
+
def with_streaming_response(self) -> BuildResourceWithStreamingResponse:
|
|
46
|
+
"""
|
|
47
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
48
|
+
|
|
49
|
+
For more information, see https://www.github.com/scaleapi/sgp-python-beta#with_streaming_response
|
|
50
|
+
"""
|
|
51
|
+
return BuildResourceWithStreamingResponse(self)
|
|
52
|
+
|
|
53
|
+
def create(
|
|
54
|
+
self,
|
|
55
|
+
*,
|
|
56
|
+
context_archive: FileTypes,
|
|
57
|
+
image_name: str,
|
|
58
|
+
build_args: str | Omit = omit,
|
|
59
|
+
image_tag: str | Omit = omit,
|
|
60
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
61
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
62
|
+
extra_headers: Headers | None = None,
|
|
63
|
+
extra_query: Query | None = None,
|
|
64
|
+
extra_body: Body | None = None,
|
|
65
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
66
|
+
) -> BuildCreateResponse:
|
|
67
|
+
"""
|
|
68
|
+
Submit a container image build.
|
|
69
|
+
|
|
70
|
+
Upload a tar.gz archive containing the build context (Dockerfile and any files
|
|
71
|
+
needed for the build) along with image name, tag, and optional build arguments.
|
|
72
|
+
|
|
73
|
+
Maximum file size: 500MB
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
context_archive: tar.gz archive containing the build context (Dockerfile and any files needed for
|
|
77
|
+
the build)
|
|
78
|
+
|
|
79
|
+
image_name: Name for the built image
|
|
80
|
+
|
|
81
|
+
build_args: JSON string of build arguments
|
|
82
|
+
|
|
83
|
+
image_tag: Tag for the built image
|
|
84
|
+
|
|
85
|
+
extra_headers: Send extra headers
|
|
86
|
+
|
|
87
|
+
extra_query: Add additional query parameters to the request
|
|
88
|
+
|
|
89
|
+
extra_body: Add additional JSON properties to the request
|
|
90
|
+
|
|
91
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
92
|
+
"""
|
|
93
|
+
body = deepcopy_minimal(
|
|
94
|
+
{
|
|
95
|
+
"context_archive": context_archive,
|
|
96
|
+
"image_name": image_name,
|
|
97
|
+
"build_args": build_args,
|
|
98
|
+
"image_tag": image_tag,
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
files = extract_files(cast(Mapping[str, object], body), paths=[["context_archive"]])
|
|
102
|
+
# It should be noted that the actual Content-Type header that will be
|
|
103
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
|
104
|
+
# multipart/form-data; boundary=---abc--
|
|
105
|
+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
|
106
|
+
return self._post(
|
|
107
|
+
"/v5/builds",
|
|
108
|
+
body=maybe_transform(body, build_create_params.BuildCreateParams),
|
|
109
|
+
files=files,
|
|
110
|
+
options=make_request_options(
|
|
111
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
112
|
+
),
|
|
113
|
+
cast_to=BuildCreateResponse,
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
def retrieve(
|
|
117
|
+
self,
|
|
118
|
+
build_id: str,
|
|
119
|
+
*,
|
|
120
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
121
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
122
|
+
extra_headers: Headers | None = None,
|
|
123
|
+
extra_query: Query | None = None,
|
|
124
|
+
extra_body: Body | None = None,
|
|
125
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
126
|
+
) -> BuildRetrieveResponse:
|
|
127
|
+
"""
|
|
128
|
+
Get a build by ID, including current status from the cloud provider.
|
|
129
|
+
|
|
130
|
+
Args:
|
|
131
|
+
extra_headers: Send extra headers
|
|
132
|
+
|
|
133
|
+
extra_query: Add additional query parameters to the request
|
|
134
|
+
|
|
135
|
+
extra_body: Add additional JSON properties to the request
|
|
136
|
+
|
|
137
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
138
|
+
"""
|
|
139
|
+
if not build_id:
|
|
140
|
+
raise ValueError(f"Expected a non-empty value for `build_id` but received {build_id!r}")
|
|
141
|
+
return self._get(
|
|
142
|
+
f"/v5/builds/{build_id}",
|
|
143
|
+
options=make_request_options(
|
|
144
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
145
|
+
),
|
|
146
|
+
cast_to=BuildRetrieveResponse,
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
def list(
|
|
150
|
+
self,
|
|
151
|
+
*,
|
|
152
|
+
ending_before: str | Omit = omit,
|
|
153
|
+
limit: int | Omit = omit,
|
|
154
|
+
sort_by: str | Omit = omit,
|
|
155
|
+
sort_order: Literal["asc", "desc"] | Omit = omit,
|
|
156
|
+
starting_after: str | Omit = omit,
|
|
157
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
158
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
159
|
+
extra_headers: Headers | None = None,
|
|
160
|
+
extra_query: Query | None = None,
|
|
161
|
+
extra_body: Body | None = None,
|
|
162
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
163
|
+
) -> SyncCursorPage[BuildListResponse]:
|
|
164
|
+
"""
|
|
165
|
+
List Builds
|
|
166
|
+
|
|
167
|
+
Args:
|
|
168
|
+
extra_headers: Send extra headers
|
|
169
|
+
|
|
170
|
+
extra_query: Add additional query parameters to the request
|
|
171
|
+
|
|
172
|
+
extra_body: Add additional JSON properties to the request
|
|
173
|
+
|
|
174
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
175
|
+
"""
|
|
176
|
+
return self._get_api_list(
|
|
177
|
+
"/v5/builds",
|
|
178
|
+
page=SyncCursorPage[BuildListResponse],
|
|
179
|
+
options=make_request_options(
|
|
180
|
+
extra_headers=extra_headers,
|
|
181
|
+
extra_query=extra_query,
|
|
182
|
+
extra_body=extra_body,
|
|
183
|
+
timeout=timeout,
|
|
184
|
+
query=maybe_transform(
|
|
185
|
+
{
|
|
186
|
+
"ending_before": ending_before,
|
|
187
|
+
"limit": limit,
|
|
188
|
+
"sort_by": sort_by,
|
|
189
|
+
"sort_order": sort_order,
|
|
190
|
+
"starting_after": starting_after,
|
|
191
|
+
},
|
|
192
|
+
build_list_params.BuildListParams,
|
|
193
|
+
),
|
|
194
|
+
),
|
|
195
|
+
model=BuildListResponse,
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
def cancel(
|
|
199
|
+
self,
|
|
200
|
+
build_id: str,
|
|
201
|
+
*,
|
|
202
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
203
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
204
|
+
extra_headers: Headers | None = None,
|
|
205
|
+
extra_query: Query | None = None,
|
|
206
|
+
extra_body: Body | None = None,
|
|
207
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
208
|
+
) -> BuildCancelResponse:
|
|
209
|
+
"""
|
|
210
|
+
Cancel a pending or running build.
|
|
211
|
+
|
|
212
|
+
Args:
|
|
213
|
+
extra_headers: Send extra headers
|
|
214
|
+
|
|
215
|
+
extra_query: Add additional query parameters to the request
|
|
216
|
+
|
|
217
|
+
extra_body: Add additional JSON properties to the request
|
|
218
|
+
|
|
219
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
220
|
+
"""
|
|
221
|
+
if not build_id:
|
|
222
|
+
raise ValueError(f"Expected a non-empty value for `build_id` but received {build_id!r}")
|
|
223
|
+
return self._post(
|
|
224
|
+
f"/v5/builds/{build_id}/cancel",
|
|
225
|
+
options=make_request_options(
|
|
226
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
227
|
+
),
|
|
228
|
+
cast_to=BuildCancelResponse,
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
def logs(
|
|
232
|
+
self,
|
|
233
|
+
build_id: str,
|
|
234
|
+
*,
|
|
235
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
236
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
237
|
+
extra_headers: Headers | None = None,
|
|
238
|
+
extra_query: Query | None = None,
|
|
239
|
+
extra_body: Body | None = None,
|
|
240
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
241
|
+
) -> Stream[StreamChunk]:
|
|
242
|
+
"""
|
|
243
|
+
Stream build logs via Server-Sent Events (SSE).
|
|
244
|
+
|
|
245
|
+
Returns a streaming response with content-type text/event-stream. Each log line
|
|
246
|
+
is sent as an SSE data event.
|
|
247
|
+
|
|
248
|
+
Args:
|
|
249
|
+
extra_headers: Send extra headers
|
|
250
|
+
|
|
251
|
+
extra_query: Add additional query parameters to the request
|
|
252
|
+
|
|
253
|
+
extra_body: Add additional JSON properties to the request
|
|
254
|
+
|
|
255
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
256
|
+
"""
|
|
257
|
+
if not build_id:
|
|
258
|
+
raise ValueError(f"Expected a non-empty value for `build_id` but received {build_id!r}")
|
|
259
|
+
return self._get(
|
|
260
|
+
f"/v5/builds/{build_id}/logs",
|
|
261
|
+
options=make_request_options(
|
|
262
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
263
|
+
),
|
|
264
|
+
cast_to=StreamChunk,
|
|
265
|
+
stream=True,
|
|
266
|
+
stream_cls=Stream[StreamChunk],
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
class AsyncBuildResource(AsyncAPIResource):
|
|
271
|
+
@cached_property
|
|
272
|
+
def with_raw_response(self) -> AsyncBuildResourceWithRawResponse:
|
|
273
|
+
"""
|
|
274
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
275
|
+
the raw response object instead of the parsed content.
|
|
276
|
+
|
|
277
|
+
For more information, see https://www.github.com/scaleapi/sgp-python-beta#accessing-raw-response-data-eg-headers
|
|
278
|
+
"""
|
|
279
|
+
return AsyncBuildResourceWithRawResponse(self)
|
|
280
|
+
|
|
281
|
+
@cached_property
|
|
282
|
+
def with_streaming_response(self) -> AsyncBuildResourceWithStreamingResponse:
|
|
283
|
+
"""
|
|
284
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
285
|
+
|
|
286
|
+
For more information, see https://www.github.com/scaleapi/sgp-python-beta#with_streaming_response
|
|
287
|
+
"""
|
|
288
|
+
return AsyncBuildResourceWithStreamingResponse(self)
|
|
289
|
+
|
|
290
|
+
async def create(
|
|
291
|
+
self,
|
|
292
|
+
*,
|
|
293
|
+
context_archive: FileTypes,
|
|
294
|
+
image_name: str,
|
|
295
|
+
build_args: str | Omit = omit,
|
|
296
|
+
image_tag: str | Omit = omit,
|
|
297
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
298
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
299
|
+
extra_headers: Headers | None = None,
|
|
300
|
+
extra_query: Query | None = None,
|
|
301
|
+
extra_body: Body | None = None,
|
|
302
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
303
|
+
) -> BuildCreateResponse:
|
|
304
|
+
"""
|
|
305
|
+
Submit a container image build.
|
|
306
|
+
|
|
307
|
+
Upload a tar.gz archive containing the build context (Dockerfile and any files
|
|
308
|
+
needed for the build) along with image name, tag, and optional build arguments.
|
|
309
|
+
|
|
310
|
+
Maximum file size: 500MB
|
|
311
|
+
|
|
312
|
+
Args:
|
|
313
|
+
context_archive: tar.gz archive containing the build context (Dockerfile and any files needed for
|
|
314
|
+
the build)
|
|
315
|
+
|
|
316
|
+
image_name: Name for the built image
|
|
317
|
+
|
|
318
|
+
build_args: JSON string of build arguments
|
|
319
|
+
|
|
320
|
+
image_tag: Tag for the built image
|
|
321
|
+
|
|
322
|
+
extra_headers: Send extra headers
|
|
323
|
+
|
|
324
|
+
extra_query: Add additional query parameters to the request
|
|
325
|
+
|
|
326
|
+
extra_body: Add additional JSON properties to the request
|
|
327
|
+
|
|
328
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
329
|
+
"""
|
|
330
|
+
body = deepcopy_minimal(
|
|
331
|
+
{
|
|
332
|
+
"context_archive": context_archive,
|
|
333
|
+
"image_name": image_name,
|
|
334
|
+
"build_args": build_args,
|
|
335
|
+
"image_tag": image_tag,
|
|
336
|
+
}
|
|
337
|
+
)
|
|
338
|
+
files = extract_files(cast(Mapping[str, object], body), paths=[["context_archive"]])
|
|
339
|
+
# It should be noted that the actual Content-Type header that will be
|
|
340
|
+
# sent to the server will contain a `boundary` parameter, e.g.
|
|
341
|
+
# multipart/form-data; boundary=---abc--
|
|
342
|
+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
|
|
343
|
+
return await self._post(
|
|
344
|
+
"/v5/builds",
|
|
345
|
+
body=await async_maybe_transform(body, build_create_params.BuildCreateParams),
|
|
346
|
+
files=files,
|
|
347
|
+
options=make_request_options(
|
|
348
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
349
|
+
),
|
|
350
|
+
cast_to=BuildCreateResponse,
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
async def retrieve(
|
|
354
|
+
self,
|
|
355
|
+
build_id: str,
|
|
356
|
+
*,
|
|
357
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
358
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
359
|
+
extra_headers: Headers | None = None,
|
|
360
|
+
extra_query: Query | None = None,
|
|
361
|
+
extra_body: Body | None = None,
|
|
362
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
363
|
+
) -> BuildRetrieveResponse:
|
|
364
|
+
"""
|
|
365
|
+
Get a build by ID, including current status from the cloud provider.
|
|
366
|
+
|
|
367
|
+
Args:
|
|
368
|
+
extra_headers: Send extra headers
|
|
369
|
+
|
|
370
|
+
extra_query: Add additional query parameters to the request
|
|
371
|
+
|
|
372
|
+
extra_body: Add additional JSON properties to the request
|
|
373
|
+
|
|
374
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
375
|
+
"""
|
|
376
|
+
if not build_id:
|
|
377
|
+
raise ValueError(f"Expected a non-empty value for `build_id` but received {build_id!r}")
|
|
378
|
+
return await self._get(
|
|
379
|
+
f"/v5/builds/{build_id}",
|
|
380
|
+
options=make_request_options(
|
|
381
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
382
|
+
),
|
|
383
|
+
cast_to=BuildRetrieveResponse,
|
|
384
|
+
)
|
|
385
|
+
|
|
386
|
+
def list(
|
|
387
|
+
self,
|
|
388
|
+
*,
|
|
389
|
+
ending_before: str | Omit = omit,
|
|
390
|
+
limit: int | Omit = omit,
|
|
391
|
+
sort_by: str | Omit = omit,
|
|
392
|
+
sort_order: Literal["asc", "desc"] | Omit = omit,
|
|
393
|
+
starting_after: str | Omit = omit,
|
|
394
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
395
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
396
|
+
extra_headers: Headers | None = None,
|
|
397
|
+
extra_query: Query | None = None,
|
|
398
|
+
extra_body: Body | None = None,
|
|
399
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
400
|
+
) -> AsyncPaginator[BuildListResponse, AsyncCursorPage[BuildListResponse]]:
|
|
401
|
+
"""
|
|
402
|
+
List Builds
|
|
403
|
+
|
|
404
|
+
Args:
|
|
405
|
+
extra_headers: Send extra headers
|
|
406
|
+
|
|
407
|
+
extra_query: Add additional query parameters to the request
|
|
408
|
+
|
|
409
|
+
extra_body: Add additional JSON properties to the request
|
|
410
|
+
|
|
411
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
412
|
+
"""
|
|
413
|
+
return self._get_api_list(
|
|
414
|
+
"/v5/builds",
|
|
415
|
+
page=AsyncCursorPage[BuildListResponse],
|
|
416
|
+
options=make_request_options(
|
|
417
|
+
extra_headers=extra_headers,
|
|
418
|
+
extra_query=extra_query,
|
|
419
|
+
extra_body=extra_body,
|
|
420
|
+
timeout=timeout,
|
|
421
|
+
query=maybe_transform(
|
|
422
|
+
{
|
|
423
|
+
"ending_before": ending_before,
|
|
424
|
+
"limit": limit,
|
|
425
|
+
"sort_by": sort_by,
|
|
426
|
+
"sort_order": sort_order,
|
|
427
|
+
"starting_after": starting_after,
|
|
428
|
+
},
|
|
429
|
+
build_list_params.BuildListParams,
|
|
430
|
+
),
|
|
431
|
+
),
|
|
432
|
+
model=BuildListResponse,
|
|
433
|
+
)
|
|
434
|
+
|
|
435
|
+
async def cancel(
|
|
436
|
+
self,
|
|
437
|
+
build_id: str,
|
|
438
|
+
*,
|
|
439
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
440
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
441
|
+
extra_headers: Headers | None = None,
|
|
442
|
+
extra_query: Query | None = None,
|
|
443
|
+
extra_body: Body | None = None,
|
|
444
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
445
|
+
) -> BuildCancelResponse:
|
|
446
|
+
"""
|
|
447
|
+
Cancel a pending or running build.
|
|
448
|
+
|
|
449
|
+
Args:
|
|
450
|
+
extra_headers: Send extra headers
|
|
451
|
+
|
|
452
|
+
extra_query: Add additional query parameters to the request
|
|
453
|
+
|
|
454
|
+
extra_body: Add additional JSON properties to the request
|
|
455
|
+
|
|
456
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
457
|
+
"""
|
|
458
|
+
if not build_id:
|
|
459
|
+
raise ValueError(f"Expected a non-empty value for `build_id` but received {build_id!r}")
|
|
460
|
+
return await self._post(
|
|
461
|
+
f"/v5/builds/{build_id}/cancel",
|
|
462
|
+
options=make_request_options(
|
|
463
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
464
|
+
),
|
|
465
|
+
cast_to=BuildCancelResponse,
|
|
466
|
+
)
|
|
467
|
+
|
|
468
|
+
async def logs(
|
|
469
|
+
self,
|
|
470
|
+
build_id: str,
|
|
471
|
+
*,
|
|
472
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
473
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
474
|
+
extra_headers: Headers | None = None,
|
|
475
|
+
extra_query: Query | None = None,
|
|
476
|
+
extra_body: Body | None = None,
|
|
477
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
478
|
+
) -> AsyncStream[StreamChunk]:
|
|
479
|
+
"""
|
|
480
|
+
Stream build logs via Server-Sent Events (SSE).
|
|
481
|
+
|
|
482
|
+
Returns a streaming response with content-type text/event-stream. Each log line
|
|
483
|
+
is sent as an SSE data event.
|
|
484
|
+
|
|
485
|
+
Args:
|
|
486
|
+
extra_headers: Send extra headers
|
|
487
|
+
|
|
488
|
+
extra_query: Add additional query parameters to the request
|
|
489
|
+
|
|
490
|
+
extra_body: Add additional JSON properties to the request
|
|
491
|
+
|
|
492
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
493
|
+
"""
|
|
494
|
+
if not build_id:
|
|
495
|
+
raise ValueError(f"Expected a non-empty value for `build_id` but received {build_id!r}")
|
|
496
|
+
return await self._get(
|
|
497
|
+
f"/v5/builds/{build_id}/logs",
|
|
498
|
+
options=make_request_options(
|
|
499
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
500
|
+
),
|
|
501
|
+
cast_to=StreamChunk,
|
|
502
|
+
stream=True,
|
|
503
|
+
stream_cls=AsyncStream[StreamChunk],
|
|
504
|
+
)
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
class BuildResourceWithRawResponse:
|
|
508
|
+
def __init__(self, build: BuildResource) -> None:
|
|
509
|
+
self._build = build
|
|
510
|
+
|
|
511
|
+
self.create = to_raw_response_wrapper(
|
|
512
|
+
build.create,
|
|
513
|
+
)
|
|
514
|
+
self.retrieve = to_raw_response_wrapper(
|
|
515
|
+
build.retrieve,
|
|
516
|
+
)
|
|
517
|
+
self.list = to_raw_response_wrapper(
|
|
518
|
+
build.list,
|
|
519
|
+
)
|
|
520
|
+
self.cancel = to_raw_response_wrapper(
|
|
521
|
+
build.cancel,
|
|
522
|
+
)
|
|
523
|
+
self.logs = to_raw_response_wrapper(
|
|
524
|
+
build.logs,
|
|
525
|
+
)
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
class AsyncBuildResourceWithRawResponse:
|
|
529
|
+
def __init__(self, build: AsyncBuildResource) -> None:
|
|
530
|
+
self._build = build
|
|
531
|
+
|
|
532
|
+
self.create = async_to_raw_response_wrapper(
|
|
533
|
+
build.create,
|
|
534
|
+
)
|
|
535
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
536
|
+
build.retrieve,
|
|
537
|
+
)
|
|
538
|
+
self.list = async_to_raw_response_wrapper(
|
|
539
|
+
build.list,
|
|
540
|
+
)
|
|
541
|
+
self.cancel = async_to_raw_response_wrapper(
|
|
542
|
+
build.cancel,
|
|
543
|
+
)
|
|
544
|
+
self.logs = async_to_raw_response_wrapper(
|
|
545
|
+
build.logs,
|
|
546
|
+
)
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
class BuildResourceWithStreamingResponse:
|
|
550
|
+
def __init__(self, build: BuildResource) -> None:
|
|
551
|
+
self._build = build
|
|
552
|
+
|
|
553
|
+
self.create = to_streamed_response_wrapper(
|
|
554
|
+
build.create,
|
|
555
|
+
)
|
|
556
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
557
|
+
build.retrieve,
|
|
558
|
+
)
|
|
559
|
+
self.list = to_streamed_response_wrapper(
|
|
560
|
+
build.list,
|
|
561
|
+
)
|
|
562
|
+
self.cancel = to_streamed_response_wrapper(
|
|
563
|
+
build.cancel,
|
|
564
|
+
)
|
|
565
|
+
self.logs = to_streamed_response_wrapper(
|
|
566
|
+
build.logs,
|
|
567
|
+
)
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
class AsyncBuildResourceWithStreamingResponse:
|
|
571
|
+
def __init__(self, build: AsyncBuildResource) -> None:
|
|
572
|
+
self._build = build
|
|
573
|
+
|
|
574
|
+
self.create = async_to_streamed_response_wrapper(
|
|
575
|
+
build.create,
|
|
576
|
+
)
|
|
577
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
578
|
+
build.retrieve,
|
|
579
|
+
)
|
|
580
|
+
self.list = async_to_streamed_response_wrapper(
|
|
581
|
+
build.list,
|
|
582
|
+
)
|
|
583
|
+
self.cancel = async_to_streamed_response_wrapper(
|
|
584
|
+
build.cancel,
|
|
585
|
+
)
|
|
586
|
+
self.logs = async_to_streamed_response_wrapper(
|
|
587
|
+
build.logs,
|
|
588
|
+
)
|
scale_gp_beta/types/__init__.py
CHANGED
|
@@ -19,6 +19,7 @@ from .evaluation import Evaluation as Evaluation
|
|
|
19
19
|
from .span_status import SpanStatus as SpanStatus
|
|
20
20
|
from .dataset_item import DatasetItem as DatasetItem
|
|
21
21
|
from .item_locator import ItemLocator as ItemLocator
|
|
22
|
+
from .stream_chunk import StreamChunk as StreamChunk
|
|
22
23
|
from .approval_status import ApprovalStatus as ApprovalStatus
|
|
23
24
|
from .assessment_type import AssessmentType as AssessmentType
|
|
24
25
|
from .component_param import ComponentParam as ComponentParam
|
|
@@ -28,6 +29,7 @@ from .evaluation_task import EvaluationTask as EvaluationTask
|
|
|
28
29
|
from .inference_model import InferenceModel as InferenceModel
|
|
29
30
|
from .span_assessment import SpanAssessment as SpanAssessment
|
|
30
31
|
from .file_list_params import FileListParams as FileListParams
|
|
32
|
+
from .build_list_params import BuildListParams as BuildListParams
|
|
31
33
|
from .credential_secret import CredentialSecret as CredentialSecret
|
|
32
34
|
from .model_list_params import ModelListParams as ModelListParams
|
|
33
35
|
from .span_batch_params import SpanBatchParams as SpanBatchParams
|
|
@@ -37,12 +39,16 @@ from .inference_response import InferenceResponse as InferenceResponse
|
|
|
37
39
|
from .span_create_params import SpanCreateParams as SpanCreateParams
|
|
38
40
|
from .span_search_params import SpanSearchParams as SpanSearchParams
|
|
39
41
|
from .span_update_params import SpanUpdateParams as SpanUpdateParams
|
|
42
|
+
from .build_create_params import BuildCreateParams as BuildCreateParams
|
|
43
|
+
from .build_list_response import BuildListResponse as BuildListResponse
|
|
40
44
|
from .dataset_list_params import DatasetListParams as DatasetListParams
|
|
41
45
|
from .model_create_params import ModelCreateParams as ModelCreateParams
|
|
42
46
|
from .model_update_params import ModelUpdateParams as ModelUpdateParams
|
|
43
47
|
from .span_batch_response import SpanBatchResponse as SpanBatchResponse
|
|
44
48
|
from .file_delete_response import FileDeleteResponse as FileDeleteResponse
|
|
45
49
|
from .question_list_params import QuestionListParams as QuestionListParams
|
|
50
|
+
from .build_cancel_response import BuildCancelResponse as BuildCancelResponse
|
|
51
|
+
from .build_create_response import BuildCreateResponse as BuildCreateResponse
|
|
46
52
|
from .dataset_create_params import DatasetCreateParams as DatasetCreateParams
|
|
47
53
|
from .dataset_update_params import DatasetUpdateParams as DatasetUpdateParams
|
|
48
54
|
from .evaluation_task_param import EvaluationTaskParam as EvaluationTaskParam
|
|
@@ -52,6 +58,7 @@ from .credential_list_params import CredentialListParams as CredentialListParams
|
|
|
52
58
|
from .evaluation_list_params import EvaluationListParams as EvaluationListParams
|
|
53
59
|
from .question_create_params import QuestionCreateParams as QuestionCreateParams
|
|
54
60
|
from .response_create_params import ResponseCreateParams as ResponseCreateParams
|
|
61
|
+
from .build_retrieve_response import BuildRetrieveResponse as BuildRetrieveResponse
|
|
55
62
|
from .dataset_delete_response import DatasetDeleteResponse as DatasetDeleteResponse
|
|
56
63
|
from .dataset_retrieve_params import DatasetRetrieveParams as DatasetRetrieveParams
|
|
57
64
|
from .inference_create_params import InferenceCreateParams as InferenceCreateParams
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
from typing_extensions import Literal
|
|
6
|
+
|
|
7
|
+
from .._models import BaseModel
|
|
8
|
+
from .shared.identity import Identity
|
|
9
|
+
|
|
10
|
+
__all__ = ["BuildCancelResponse"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class BuildCancelResponse(BaseModel):
|
|
14
|
+
account_id: str
|
|
15
|
+
|
|
16
|
+
build_id: str
|
|
17
|
+
|
|
18
|
+
created_at: datetime
|
|
19
|
+
|
|
20
|
+
created_by: Identity
|
|
21
|
+
"""The identity that created the entity."""
|
|
22
|
+
|
|
23
|
+
image_name: str
|
|
24
|
+
|
|
25
|
+
image_tag: str
|
|
26
|
+
|
|
27
|
+
image_url: str
|
|
28
|
+
|
|
29
|
+
status: str
|
|
30
|
+
"""The current build status from the cloud provider"""
|
|
31
|
+
|
|
32
|
+
build_end_time: Optional[datetime] = None
|
|
33
|
+
"""When the cloud provider finished the build"""
|
|
34
|
+
|
|
35
|
+
build_start_time: Optional[datetime] = None
|
|
36
|
+
"""When the cloud provider started the build"""
|
|
37
|
+
|
|
38
|
+
object: Optional[Literal["agentex_cloud_build"]] = None
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Required, TypedDict
|
|
6
|
+
|
|
7
|
+
from .._types import FileTypes
|
|
8
|
+
|
|
9
|
+
__all__ = ["BuildCreateParams"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class BuildCreateParams(TypedDict, total=False):
|
|
13
|
+
context_archive: Required[FileTypes]
|
|
14
|
+
"""
|
|
15
|
+
tar.gz archive containing the build context (Dockerfile and any files needed for
|
|
16
|
+
the build)
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
image_name: Required[str]
|
|
20
|
+
"""Name for the built image"""
|
|
21
|
+
|
|
22
|
+
build_args: str
|
|
23
|
+
"""JSON string of build arguments"""
|
|
24
|
+
|
|
25
|
+
image_tag: str
|
|
26
|
+
"""Tag for the built image"""
|