Skip to content

Commit 3020f50

Browse files
authored
Merge pull request opensandbox-group#1002 from ninan-nn/feature/update_generated_code_20260608
chore(sdks): update auto-generated code
2 parents bb47d01 + da69906 commit 3020f50

3 files changed

Lines changed: 94 additions & 39 deletions

File tree

sdks/sandbox/javascript/src/api/lifecycle.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -689,14 +689,14 @@ export interface paths {
689689
get: {
690690
parameters: {
691691
query?: {
692-
/** @description Whether to return a server-proxied URL */
692+
/** @description Whether to return a server-proxied URL. Cannot be combined with `expires`. */
693693
use_server_proxy?: boolean;
694694
/**
695695
* @description Optional. When set, the server **issues a signed** access route (OSEP-0011). The value
696696
* is **Linux / Unix epoch seconds** — a decimal `uint64` count of **whole seconds** since
697697
* the Unix epoch (`1970-01-01 00:00:00` UTC, same as POSIX / `time(2)`), not
698698
* milliseconds. Normalized to `expires_b36` for the four-segment route token. Omit to
699-
* get the unsigned/legacy response shape.
699+
* get the unsigned/legacy response shape. Cannot be combined with `use_server_proxy=true`.
700700
*/
701701
expires?: string;
702702
};
@@ -1008,13 +1008,21 @@ export interface components {
10081008
[key: string]: string | null;
10091009
};
10101010
/**
1011-
* @description Request to create a new sandbox from either a container image or a snapshot.
1012-
* Exactly one of `image` or `snapshotId` must be provided.
1011+
* @description Request to create a new sandbox from either a container image, a snapshot,
1012+
* or a pre-configured pool (via `extensions.poolRef`).
1013+
*
1014+
* **Standard mode**: Exactly one of `image` or `snapshotId` must be provided,
1015+
* and `resourceLimits` is required.
10131016
*
10141017
* When `image` is provided, `entrypoint` is required. When `snapshotId` is
10151018
* provided, `entrypoint` is optional. If omitted, the server defaults the
10161019
* sandbox entrypoint to `["tail", "-f", "/dev/null"]`.
10171020
*
1021+
* **Pool mode**: When `extensions.poolRef` is set, the sandbox is created from
1022+
* a pre-configured pool. In this case `image`, `entrypoint`, and
1023+
* `resourceLimits` are all optional (defined by the Pool CRD template).
1024+
* `snapshotId` must not be provided together with `poolRef`.
1025+
*
10181026
* **Note**: API Key authentication is required via the `OPEN-SANDBOX-API-KEY` header.
10191027
*/
10201028
CreateSandboxRequest: {
@@ -1047,9 +1055,11 @@ export interface components {
10471055
timeout?: number | null;
10481056
/**
10491057
* @description Runtime resource constraints for the sandbox instance.
1058+
* Required when `extensions.poolRef` is not set.
1059+
* Optional when using pool mode (resource limits are defined by the Pool CRD template).
10501060
* SDK clients should provide sensible defaults (e.g., cpu: "500m", memory: "512Mi").
10511061
*/
1052-
resourceLimits: components["schemas"]["ResourceLimits"];
1062+
resourceLimits?: components["schemas"]["ResourceLimits"];
10531063
/**
10541064
* @description Environment variables to inject into the sandbox runtime.
10551065
* @example {

sdks/sandbox/python/src/opensandbox/api/lifecycle/api/sandboxes/post_sandboxes.py

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,22 @@ def sync_detailed(
116116
- `OPEN-SANDBOX-API-KEY: <api-key>` header
117117
118118
Args:
119-
body (CreateSandboxRequest): Request to create a new sandbox from either a container image
120-
or a snapshot.
121-
Exactly one of `image` or `snapshotId` must be provided.
119+
body (CreateSandboxRequest): Request to create a new sandbox from either a container
120+
image, a snapshot,
121+
or a pre-configured pool (via `extensions.poolRef`).
122+
123+
**Standard mode**: Exactly one of `image` or `snapshotId` must be provided,
124+
and `resourceLimits` is required.
122125
123126
When `image` is provided, `entrypoint` is required. When `snapshotId` is
124127
provided, `entrypoint` is optional. If omitted, the server defaults the
125128
sandbox entrypoint to `["tail", "-f", "/dev/null"]`.
126129
130+
**Pool mode**: When `extensions.poolRef` is set, the sandbox is created from
131+
a pre-configured pool. In this case `image`, `entrypoint`, and
132+
`resourceLimits` are all optional (defined by the Pool CRD template).
133+
`snapshotId` must not be provided together with `poolRef`.
134+
127135
**Note**: API Key authentication is required via the `OPEN-SANDBOX-API-KEY` header.
128136
129137
Raises:
@@ -170,14 +178,22 @@ def sync(
170178
- `OPEN-SANDBOX-API-KEY: <api-key>` header
171179
172180
Args:
173-
body (CreateSandboxRequest): Request to create a new sandbox from either a container image
174-
or a snapshot.
175-
Exactly one of `image` or `snapshotId` must be provided.
181+
body (CreateSandboxRequest): Request to create a new sandbox from either a container
182+
image, a snapshot,
183+
or a pre-configured pool (via `extensions.poolRef`).
184+
185+
**Standard mode**: Exactly one of `image` or `snapshotId` must be provided,
186+
and `resourceLimits` is required.
176187
177188
When `image` is provided, `entrypoint` is required. When `snapshotId` is
178189
provided, `entrypoint` is optional. If omitted, the server defaults the
179190
sandbox entrypoint to `["tail", "-f", "/dev/null"]`.
180191
192+
**Pool mode**: When `extensions.poolRef` is set, the sandbox is created from
193+
a pre-configured pool. In this case `image`, `entrypoint`, and
194+
`resourceLimits` are all optional (defined by the Pool CRD template).
195+
`snapshotId` must not be provided together with `poolRef`.
196+
181197
**Note**: API Key authentication is required via the `OPEN-SANDBOX-API-KEY` header.
182198
183199
Raises:
@@ -219,14 +235,22 @@ async def asyncio_detailed(
219235
- `OPEN-SANDBOX-API-KEY: <api-key>` header
220236
221237
Args:
222-
body (CreateSandboxRequest): Request to create a new sandbox from either a container image
223-
or a snapshot.
224-
Exactly one of `image` or `snapshotId` must be provided.
238+
body (CreateSandboxRequest): Request to create a new sandbox from either a container
239+
image, a snapshot,
240+
or a pre-configured pool (via `extensions.poolRef`).
241+
242+
**Standard mode**: Exactly one of `image` or `snapshotId` must be provided,
243+
and `resourceLimits` is required.
225244
226245
When `image` is provided, `entrypoint` is required. When `snapshotId` is
227246
provided, `entrypoint` is optional. If omitted, the server defaults the
228247
sandbox entrypoint to `["tail", "-f", "/dev/null"]`.
229248
249+
**Pool mode**: When `extensions.poolRef` is set, the sandbox is created from
250+
a pre-configured pool. In this case `image`, `entrypoint`, and
251+
`resourceLimits` are all optional (defined by the Pool CRD template).
252+
`snapshotId` must not be provided together with `poolRef`.
253+
230254
**Note**: API Key authentication is required via the `OPEN-SANDBOX-API-KEY` header.
231255
232256
Raises:
@@ -271,14 +295,22 @@ async def asyncio(
271295
- `OPEN-SANDBOX-API-KEY: <api-key>` header
272296
273297
Args:
274-
body (CreateSandboxRequest): Request to create a new sandbox from either a container image
275-
or a snapshot.
276-
Exactly one of `image` or `snapshotId` must be provided.
298+
body (CreateSandboxRequest): Request to create a new sandbox from either a container
299+
image, a snapshot,
300+
or a pre-configured pool (via `extensions.poolRef`).
301+
302+
**Standard mode**: Exactly one of `image` or `snapshotId` must be provided,
303+
and `resourceLimits` is required.
277304
278305
When `image` is provided, `entrypoint` is required. When `snapshotId` is
279306
provided, `entrypoint` is optional. If omitted, the server defaults the
280307
sandbox entrypoint to `["tail", "-f", "/dev/null"]`.
281308
309+
**Pool mode**: When `extensions.poolRef` is set, the sandbox is created from
310+
a pre-configured pool. In this case `image`, `entrypoint`, and
311+
`resourceLimits` are all optional (defined by the Pool CRD template).
312+
`snapshotId` must not be provided together with `poolRef`.
313+
282314
**Note**: API Key authentication is required via the `OPEN-SANDBOX-API-KEY` header.
283315
284316
Raises:

sdks/sandbox/python/src/opensandbox/api/lifecycle/models/create_sandbox_request.py

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,24 @@
4040

4141
@_attrs_define
4242
class CreateSandboxRequest:
43-
"""Request to create a new sandbox from either a container image or a snapshot.
44-
Exactly one of `image` or `snapshotId` must be provided.
43+
"""Request to create a new sandbox from either a container image, a snapshot,
44+
or a pre-configured pool (via `extensions.poolRef`).
45+
46+
**Standard mode**: Exactly one of `image` or `snapshotId` must be provided,
47+
and `resourceLimits` is required.
4548
4649
When `image` is provided, `entrypoint` is required. When `snapshotId` is
4750
provided, `entrypoint` is optional. If omitted, the server defaults the
4851
sandbox entrypoint to `["tail", "-f", "/dev/null"]`.
4952
53+
**Pool mode**: When `extensions.poolRef` is set, the sandbox is created from
54+
a pre-configured pool. In this case `image`, `entrypoint`, and
55+
`resourceLimits` are all optional (defined by the Pool CRD template).
56+
`snapshotId` must not be provided together with `poolRef`.
57+
5058
**Note**: API Key authentication is required via the `OPEN-SANDBOX-API-KEY` header.
5159
5260
Attributes:
53-
resource_limits (ResourceLimits): Runtime resource constraints as key-value pairs. Similar to Kubernetes
54-
resource specifications,
55-
allows flexible definition of resource limits. Common resource types include:
56-
- `cpu`: CPU allocation in millicores (e.g., "250m" for 0.25 CPU cores)
57-
- `memory`: Memory allocation in bytes or human-readable format (e.g., "512Mi", "1Gi")
58-
- `gpu`: Number of GPU devices (e.g., "1")
59-
60-
New resource types can be added without API changes.
61-
Example: {'cpu': '500m', 'memory': '512Mi', 'gpu': '1'}.
6261
image (ImageSpec | Unset): Container image specification for sandbox provisioning.
6362
6463
Supports public registry images and private registry images with authentication.
@@ -82,6 +81,15 @@ class CreateSandboxRequest:
8281
Omit this field or set it to null to disable automatic expiration and require explicit cleanup.
8382
Note: manual cleanup support is runtime-dependent; Kubernetes providers may reject
8483
omitted or null timeout when the underlying workload provider does not support non-expiring sandboxes.
84+
resource_limits (ResourceLimits | Unset): Runtime resource constraints as key-value pairs. Similar to Kubernetes
85+
resource specifications,
86+
allows flexible definition of resource limits. Common resource types include:
87+
- `cpu`: CPU allocation in millicores (e.g., "250m" for 0.25 CPU cores)
88+
- `memory`: Memory allocation in bytes or human-readable format (e.g., "512Mi", "1Gi")
89+
- `gpu`: Number of GPU devices (e.g., "1")
90+
91+
New resource types can be added without API changes.
92+
Example: {'cpu': '500m', 'memory': '512Mi', 'gpu': '1'}.
8593
env (CreateSandboxRequestEnv | Unset): Environment variables to inject into the sandbox runtime. Example:
8694
{'API_KEY': 'secret-key', 'DEBUG': 'true', 'LOG_LEVEL': 'info'}.
8795
metadata (CreateSandboxRequestMetadata | Unset): Custom key-value metadata for management, filtering, and
@@ -140,11 +148,11 @@ class CreateSandboxRequest:
140148
via `validate_extensions` in server `src/extensions/validation.py`).
141149
"""
142150

143-
resource_limits: ResourceLimits
144151
image: ImageSpec | Unset = UNSET
145152
snapshot_id: str | Unset = UNSET
146153
platform: PlatformSpec | Unset = UNSET
147154
timeout: int | None | Unset = UNSET
155+
resource_limits: ResourceLimits | Unset = UNSET
148156
env: CreateSandboxRequestEnv | Unset = UNSET
149157
metadata: CreateSandboxRequestMetadata | Unset = UNSET
150158
entrypoint: list[str] | Unset = UNSET
@@ -155,8 +163,6 @@ class CreateSandboxRequest:
155163
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
156164

157165
def to_dict(self) -> dict[str, Any]:
158-
resource_limits = self.resource_limits.to_dict()
159-
160166
image: dict[str, Any] | Unset = UNSET
161167
if not isinstance(self.image, Unset):
162168
image = self.image.to_dict()
@@ -173,6 +179,10 @@ def to_dict(self) -> dict[str, Any]:
173179
else:
174180
timeout = self.timeout
175181

182+
resource_limits: dict[str, Any] | Unset = UNSET
183+
if not isinstance(self.resource_limits, Unset):
184+
resource_limits = self.resource_limits.to_dict()
185+
176186
env: dict[str, Any] | Unset = UNSET
177187
if not isinstance(self.env, Unset):
178188
env = self.env.to_dict()
@@ -204,11 +214,7 @@ def to_dict(self) -> dict[str, Any]:
204214

205215
field_dict: dict[str, Any] = {}
206216
field_dict.update(self.additional_properties)
207-
field_dict.update(
208-
{
209-
"resourceLimits": resource_limits,
210-
}
211-
)
217+
field_dict.update({})
212218
if image is not UNSET:
213219
field_dict["image"] = image
214220
if snapshot_id is not UNSET:
@@ -217,6 +223,8 @@ def to_dict(self) -> dict[str, Any]:
217223
field_dict["platform"] = platform
218224
if timeout is not UNSET:
219225
field_dict["timeout"] = timeout
226+
if resource_limits is not UNSET:
227+
field_dict["resourceLimits"] = resource_limits
220228
if env is not UNSET:
221229
field_dict["env"] = env
222230
if metadata is not UNSET:
@@ -246,8 +254,6 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
246254
from ..models.volume import Volume
247255

248256
d = dict(src_dict)
249-
resource_limits = ResourceLimits.from_dict(d.pop("resourceLimits"))
250-
251257
_image = d.pop("image", UNSET)
252258
image: ImageSpec | Unset
253259
if isinstance(_image, Unset):
@@ -273,6 +279,13 @@ def _parse_timeout(data: object) -> int | None | Unset:
273279

274280
timeout = _parse_timeout(d.pop("timeout", UNSET))
275281

282+
_resource_limits = d.pop("resourceLimits", UNSET)
283+
resource_limits: ResourceLimits | Unset
284+
if isinstance(_resource_limits, Unset):
285+
resource_limits = UNSET
286+
else:
287+
resource_limits = ResourceLimits.from_dict(_resource_limits)
288+
276289
_env = d.pop("env", UNSET)
277290
env: CreateSandboxRequestEnv | Unset
278291
if isinstance(_env, Unset):
@@ -315,11 +328,11 @@ def _parse_timeout(data: object) -> int | None | Unset:
315328
extensions = CreateSandboxRequestExtensions.from_dict(_extensions)
316329

317330
create_sandbox_request = cls(
318-
resource_limits=resource_limits,
319331
image=image,
320332
snapshot_id=snapshot_id,
321333
platform=platform,
322334
timeout=timeout,
335+
resource_limits=resource_limits,
323336
env=env,
324337
metadata=metadata,
325338
entrypoint=entrypoint,

0 commit comments

Comments
 (0)