-
Notifications
You must be signed in to change notification settings - Fork 928
Expand file tree
/
Copy pathlifecycle.ts
More file actions
1457 lines (1455 loc) · 60.5 KB
/
lifecycle.ts
File metadata and controls
1457 lines (1455 loc) · 60.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2026 Alibaba Group Holding Ltd..
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* This file was auto-generated by openapi-typescript.
* Do not make direct changes to the file.
*/
export interface paths {
"/sandboxes": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/**
* List sandboxes
* @description List all sandboxes with optional filtering and pagination using query parameters.
* All filter conditions use AND logic. Multiple `state` parameters use OR logic within states.
*/
get: {
parameters: {
query?: {
/**
* @description Filter by lifecycle state. Pass multiple times for OR logic.
* Example: `?state=Running&state=Paused`
*/
state?: string[];
/**
* @description Arbitrary metadata key-value pairs for filtering,keys and values must be url encoded
* Example: To filter by `project=Apollo` and `note=Demo Test`: `?metadata=project%3DApollo%26note%3DDemo%252520Test`
*/
metadata?: string;
/** @description Page number for pagination */
page?: number;
/** @description Number of items per page */
pageSize?: number;
};
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Paginated collection of sandboxes */
200: {
headers: {
"X-Request-ID": components["headers"]["XRequestId"];
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ListSandboxesResponse"];
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
500: components["responses"]["InternalServerError"];
};
};
put?: never;
/**
* Create a sandbox
* @description Creates a new sandbox from a container image or restores one from a
* persistent sandbox snapshot with optional resource limits, environment
* variables, and metadata.
*
* Exactly one startup source must be provided:
* - `image` to provision directly from a container image.
* - `snapshotId` to restore from a previously created snapshot.
*
* When `image` is provided, `entrypoint` is required. When `snapshotId` is
* provided, `entrypoint` is optional. If omitted, the server defaults the
* sandbox entrypoint to `["tail", "-f", "/dev/null"]`.
*
* ## Authentication
*
* API Key authentication is required via:
* - `OPEN-SANDBOX-API-KEY: <api-key>` header
*/
post: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["CreateSandboxRequest"];
};
};
responses: {
/**
* @description Sandbox created and accepted for provisioning.
*
* The returned sandbox includes:
* - `id`: Unique sandbox identifier
* - `status.state: "Pending"` (auto-starting provisioning or restore)
* - `status.reason` and `status.message` indicating initialization stage
* - `metadata`, `expiresAt`, `createdAt`: Core sandbox information
*
* Note: startup source details and `updatedAt` are not included in the create response.
* Use GET /sandboxes/{sandboxId} to retrieve the complete sandbox information.
*
* To track provisioning progress, poll GET /sandboxes/{sandboxId}.
* The sandbox will automatically transition to `Running` state once provisioning or restore completes.
*/
202: {
headers: {
"X-Request-ID": components["headers"]["XRequestId"];
Location: components["headers"]["Location"];
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["CreateSandboxResponse"];
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
409: components["responses"]["Conflict"];
500: components["responses"]["InternalServerError"];
};
};
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/snapshots": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/**
* List snapshots
* @description List all snapshots with optional filtering and pagination using query parameters.
* Snapshots are persistent captures of sandbox state and may outlive the source sandbox.
*/
get: {
parameters: {
query?: {
/** @description Filter snapshots by source sandbox identifier */
sandboxId?: string;
/**
* @description Filter by snapshot lifecycle state. Pass multiple times for OR logic.
* Example: `?state=Ready&state=Failed`
*/
state?: components["schemas"]["SnapshotState"][];
/** @description Page number for pagination */
page?: number;
/** @description Number of items per page */
pageSize?: number;
};
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Paginated collection of snapshots */
200: {
headers: {
"X-Request-ID": components["headers"]["XRequestId"];
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ListSnapshotsResponse"];
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
500: components["responses"]["InternalServerError"];
};
};
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/snapshots/{snapshotId}": {
parameters: {
query?: never;
header?: never;
path: {
/** @description Unique snapshot identifier */
snapshotId: components["parameters"]["SnapshotId"];
};
cookie?: never;
};
/**
* Fetch a snapshot by id
* @description Returns snapshot state and metadata.
*/
get: {
parameters: {
query?: never;
header?: never;
path: {
/** @description Unique snapshot identifier */
snapshotId: components["parameters"]["SnapshotId"];
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Snapshot current state and metadata */
200: {
headers: {
"X-Request-ID": components["headers"]["XRequestId"];
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Snapshot"];
};
};
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
404: components["responses"]["NotFound"];
409: components["responses"]["Conflict"];
500: components["responses"]["InternalServerError"];
};
};
put?: never;
post?: never;
/**
* Delete a snapshot
* @description Delete a persistent sandbox snapshot by id. Snapshots that are still
* being created cannot be deleted.
*
* For Kubernetes-backed snapshots, deletion removes OpenSandbox metadata
* and Kubernetes coordination resources, but does not guarantee removal
* of pushed OCI images from the configured registry. Use registry
* retention or garbage collection policies for image lifecycle cleanup.
*/
delete: {
parameters: {
query?: never;
header?: never;
path: {
/** @description Unique snapshot identifier */
snapshotId: components["parameters"]["SnapshotId"];
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Snapshot successfully deleted */
204: {
headers: {
"X-Request-ID": components["headers"]["XRequestId"];
[name: string]: unknown;
};
content?: never;
};
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
404: components["responses"]["NotFound"];
409: components["responses"]["Conflict"];
500: components["responses"]["InternalServerError"];
};
};
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/sandboxes/{sandboxId}": {
parameters: {
query?: never;
header?: never;
path: {
/** @description Unique sandbox identifier */
sandboxId: components["parameters"]["SandboxId"];
};
cookie?: never;
};
/**
* Fetch a sandbox by id
* @description Returns the complete sandbox information including:
* - `id`, `status`, `metadata`, `expiresAt`, `createdAt`: Core information
* - `image` or `snapshotId`: Startup source information (not included in create response)
* - `entrypoint`: Entry process specification
*
* This is the complete representation of the sandbox resource.
*/
get: {
parameters: {
query?: never;
header?: never;
path: {
/** @description Unique sandbox identifier */
sandboxId: components["parameters"]["SandboxId"];
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Sandbox current state and metadata */
200: {
headers: {
"X-Request-ID": components["headers"]["XRequestId"];
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Sandbox"];
};
};
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
404: components["responses"]["NotFound"];
500: components["responses"]["InternalServerError"];
};
};
put?: never;
post?: never;
/**
* Delete a sandbox
* @description Delete a sandbox, terminating its execution. The sandbox will transition through Stopping state to Terminated.
*/
delete: {
parameters: {
query?: never;
header?: never;
path: {
/** @description Unique sandbox identifier */
sandboxId: components["parameters"]["SandboxId"];
};
cookie?: never;
};
requestBody?: never;
responses: {
/**
* @description Sandbox successfully deleted.
*
* Sandbox has been scheduled for termination and will transition to Stopping state, then Terminated.
*/
204: {
headers: {
"X-Request-ID": components["headers"]["XRequestId"];
[name: string]: unknown;
};
content?: never;
};
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
404: components["responses"]["NotFound"];
409: components["responses"]["Conflict"];
500: components["responses"]["InternalServerError"];
};
};
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/sandboxes/{sandboxId}/metadata": {
parameters: {
query?: never;
header?: never;
path: {
/** @description Unique sandbox identifier */
sandboxId: components["parameters"]["SandboxId"];
};
cookie?: never;
};
get?: never;
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
/**
* Patch sandbox metadata
* @description Update sandbox metadata using JSON Merge Patch semantics (RFC 7396).
*
* **Merge Patch rules:**
* | Request body key/value | Behavior |
* |---|---|
* | `"key": "value"` | Add or replace the key |
* | `"key": null` | Delete the key (silently ignored if key does not exist) |
* | key absent | Keep current value (no change) |
* | Empty `{}` | No-op, returns current metadata |
*
* Metadata keys and values must comply with Kubernetes label rules:
* - Keys must be valid DNS label names or prefixed DNS subdomains
* - Keys with the `opensandbox.io/` prefix are reserved and rejected
* - Values must be 63 characters or less, matching `[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?`
*
* This operation does not restart or recreate the sandbox container/pod.
*
* **Concurrency:** This endpoint uses read-modify-write without optimistic
* locking (no `resourceVersion` check). Concurrent PATCH requests may
* interleave and silently drop updates. Use a single writer or coordinate
* out-of-band when concurrent modifications to the same key are expected.
*/
patch: {
parameters: {
query?: never;
header?: never;
path: {
/** @description Unique sandbox identifier */
sandboxId: components["parameters"]["SandboxId"];
};
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["PatchSandboxMetadataRequest"];
};
};
responses: {
/**
* @description Metadata patched successfully. Returns the complete sandbox resource
* with updated metadata.
*/
200: {
headers: {
"X-Request-ID": components["headers"]["XRequestId"];
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Sandbox"];
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
404: components["responses"]["NotFound"];
409: components["responses"]["Conflict"];
500: components["responses"]["InternalServerError"];
};
};
trace?: never;
};
"/sandboxes/{sandboxId}/snapshots": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/**
* Create a snapshot from a sandbox
* @description Create a persistent point-in-time snapshot from the sandbox's current state.
* The source sandbox must be `Running`. The returned snapshot id identifies
* the created artifact. Snapshot creation may temporarily pause the sandbox
* while the runtime captures provider-supported state, then the source
* sandbox continues running.
*/
post: {
parameters: {
query?: never;
header?: never;
path: {
/** @description Unique sandbox identifier */
sandboxId: components["parameters"]["SandboxId"];
};
cookie?: never;
};
requestBody?: {
content: {
"application/json": components["schemas"]["CreateSnapshotRequest"];
};
};
responses: {
/**
* @description Snapshot creation accepted.
*
* The returned snapshot includes `status.state: "Creating"`.
* Poll GET /snapshots/{snapshotId} to track progress until the snapshot
* transitions to `Ready` or `Failed`.
*/
202: {
headers: {
"X-Request-ID": components["headers"]["XRequestId"];
Location: components["headers"]["Location"];
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Snapshot"];
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
404: components["responses"]["NotFound"];
409: components["responses"]["Conflict"];
500: components["responses"]["InternalServerError"];
};
};
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/sandboxes/{sandboxId}/pause": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/**
* Pause execution while retaining state
* @description Pause a running sandbox while preserving its state. Poll GET /sandboxes/{sandboxId} to track state transition through Pausing and eventually Paused.
*/
post: {
parameters: {
query?: never;
header?: never;
path: {
/** @description Unique sandbox identifier */
sandboxId: components["parameters"]["SandboxId"];
};
cookie?: never;
};
requestBody?: never;
responses: {
/**
* @description Pause operation accepted.
*
* Sandbox will transition to Pausing state and eventually Paused.
* Poll GET /sandboxes/{sandboxId} to track progress.
*/
202: {
headers: {
"X-Request-ID": components["headers"]["XRequestId"];
[name: string]: unknown;
};
content?: never;
};
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
404: components["responses"]["NotFound"];
409: components["responses"]["Conflict"];
500: components["responses"]["InternalServerError"];
};
};
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/sandboxes/{sandboxId}/resume": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/**
* Resume a paused sandbox
* @description Resume execution of a paused sandbox. Poll GET /sandboxes/{sandboxId} to track state transition through Resuming and eventually Running.
*/
post: {
parameters: {
query?: never;
header?: never;
path: {
/** @description Unique sandbox identifier */
sandboxId: components["parameters"]["SandboxId"];
};
cookie?: never;
};
requestBody?: never;
responses: {
/**
* @description Resume operation accepted.
*
* Sandbox will transition from Paused → Resuming → Running.
* Poll GET /sandboxes/{sandboxId} to track progress.
*/
202: {
headers: {
"X-Request-ID": components["headers"]["XRequestId"];
[name: string]: unknown;
};
content?: never;
};
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
404: components["responses"]["NotFound"];
409: components["responses"]["Conflict"];
500: components["responses"]["InternalServerError"];
};
};
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/sandboxes/{sandboxId}/renew-expiration": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/**
* Renew sandbox expiration
* @description Renew the absolute expiration time of a sandbox.
*/
post: {
parameters: {
query?: never;
header?: never;
path: {
/** @description Unique sandbox identifier */
sandboxId: components["parameters"]["SandboxId"];
};
cookie?: never;
};
requestBody: {
content: {
"application/json": components["schemas"]["RenewSandboxExpirationRequest"];
};
};
responses: {
/**
* @description Sandbox expiration updated successfully.
*
* Returns only the updated expiresAt field.
*/
200: {
headers: {
"X-Request-ID": components["headers"]["XRequestId"];
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["RenewSandboxExpirationResponse"];
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
404: components["responses"]["NotFound"];
409: components["responses"]["Conflict"];
500: components["responses"]["InternalServerError"];
};
};
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/sandboxes/{sandboxId}/endpoints/{port}": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/**
* Get sandbox access endpoint
* @description Get the public access endpoint URL for accessing a service running on a specific port
* within the sandbox. The service must be listening on the specified port inside
* the sandbox for the endpoint to be available.
*/
get: {
parameters: {
query?: {
/** @description Whether to return a server-proxied URL */
use_server_proxy?: boolean;
/**
* @description Optional. When set, the server **issues a signed** access route (OSEP-0011). The value
* is **Linux / Unix epoch seconds** — a decimal `uint64` count of **whole seconds** since
* the Unix epoch (`1970-01-01 00:00:00` UTC, same as POSIX / `time(2)`), not
* milliseconds. Normalized to `expires_b36` for the four-segment route token. Omit to
* get the unsigned/legacy response shape.
*/
expires?: string;
};
header?: never;
path: {
/** @description Unique sandbox identifier */
sandboxId: components["parameters"]["SandboxId"];
/** @description Port number where the service is listening inside the sandbox */
port: number;
};
cookie?: never;
};
requestBody?: never;
responses: {
/**
* @description Endpoint retrieved successfully.
*
* Returns the public URL for accessing the service on the specified port.
*/
200: {
headers: {
"X-Request-ID": components["headers"]["XRequestId"];
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Endpoint"];
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
404: components["responses"]["NotFound"];
500: components["responses"]["InternalServerError"];
};
};
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
}
export type webhooks = Record<string, never>;
export interface components {
schemas: {
ListSandboxesResponse: {
items: components["schemas"]["Sandbox"][];
pagination: components["schemas"]["PaginationInfo"];
};
ListSnapshotsResponse: {
items: components["schemas"]["Snapshot"][];
pagination: components["schemas"]["PaginationInfo"];
};
/** @description Pagination metadata for list responses */
PaginationInfo: {
/** @description Current page number */
page: number;
/** @description Number of items per page */
pageSize: number;
/** @description Total number of items matching the filter */
totalItems: number;
/** @description Total number of pages */
totalPages: number;
/** @description Whether there are more pages after the current one */
hasNextPage: boolean;
};
/** @description Response from creating a new sandbox. Contains essential information without startup source details and updatedAt. */
CreateSandboxResponse: {
/** @description Unique sandbox identifier */
id: string;
/** @description Current lifecycle status and detailed state information */
status: components["schemas"]["SandboxStatus"];
/** @description Custom metadata from creation request */
metadata?: {
[key: string]: string;
};
/**
* @description Platform constraint echoed from request or workload template.
* Null when no scheduling constraint is provided.
*/
platform?: components["schemas"]["PlatformSpec"];
/**
* Format: date-time
* @description Timestamp when sandbox will auto-terminate. Omitted when manual cleanup is enabled.
*/
expiresAt?: string;
/**
* Format: date-time
* @description Sandbox creation timestamp
*/
createdAt: string;
/**
* @description Entry process specification for the sandbox. For image-created sandboxes,
* this is copied from the creation request. For snapshot-created sandboxes,
* this is restored from the snapshot.
*/
entrypoint: string[];
};
/** @description Optional settings for creating a sandbox snapshot. */
CreateSnapshotRequest: {
/** @description Optional human-readable snapshot name. */
name?: string;
};
/** @description Persistent point-in-time capture of a sandbox. */
Snapshot: {
/** @description Unique snapshot identifier */
id: string;
/** @description Source sandbox identifier used to create this snapshot */
sandboxId: string;
/** @description Optional human-readable snapshot name */
name?: string;
/** @description Current snapshot lifecycle status and detailed state information */
status: components["schemas"]["SnapshotStatus"];
/**
* Format: date-time
* @description Snapshot creation timestamp
*/
createdAt: string;
};
/**
* @description Snapshot lifecycle state.
*
* Common state values:
* - Creating: Snapshot creation has been accepted and runtime capture is in progress.
* - Deleting: Snapshot deletion has been requested and cleanup is in progress.
* - Ready: Snapshot is available for restoring sandboxes.
* - Failed: Snapshot creation failed.
*
* Note: New state values may be added in future versions.
* Clients should handle unknown state values gracefully.
*/
SnapshotState: string;
/** @description Detailed snapshot status information with lifecycle state and transition details. */
SnapshotStatus: {
/** @description Current lifecycle state of the snapshot */
state: components["schemas"]["SnapshotState"];
/**
* @description Short machine-readable reason code for the current state.
* Examples: "snapshot_accepted", "snapshot_ready", "snapshot_capture_failed"
*/
reason?: string;
/** @description Human-readable message describing the current state or failure reason */
message?: string;
/**
* Format: date-time
* @description Timestamp of the last state transition
*/
lastTransitionAt?: string;
};
/** @description Runtime execution environment provisioned from a container image or restored from a snapshot */
Sandbox: {
/** @description Unique sandbox identifier */
id: string;
/**
* @description Container image specification used to provision this sandbox.
* Present when the sandbox was created directly from a container image.
* Not returned in createSandbox response.
*/
image?: components["schemas"]["ImageSpec"];
/**
* @description Snapshot identifier used to restore this sandbox.
* Present when the sandbox was restored from a snapshot.
* Not returned in createSandbox response.
*/
snapshotId?: string;
/**
* @description Platform constraint echoed from request or workload template.
* Null when no scheduling constraint is provided.
*/
platform?: components["schemas"]["PlatformSpec"];
/** @description Current lifecycle status and detailed state information */
status: components["schemas"]["SandboxStatus"];
/** @description Custom metadata from creation request */
metadata?: {
[key: string]: string;
};
/**
* @description The command to execute as the sandbox's entry process.
* Always present in responses. For image-created sandboxes, this is copied
* from the creation request. For snapshot-created sandboxes, this is restored
* from the snapshot.
*/
entrypoint: string[];
/**
* Format: date-time
* @description Timestamp when sandbox will auto-terminate. Omitted when manual cleanup is enabled.
*/
expiresAt?: string;
/**
* Format: date-time
* @description Sandbox creation timestamp
*/
createdAt: string;
};
/**
* @description High-level lifecycle state of the sandbox.
*
* Common state values:
* - Pending: Sandbox is being provisioned
* - Running: Sandbox is running and ready to accept requests
* - Pausing: Sandbox is in the process of pausing
* - Paused: Sandbox has been paused while retaining its state
* - Resuming: Sandbox is being restored after a pause
* - Stopping: Sandbox is being terminated
* - Terminated: Sandbox has been successfully terminated
* - Failed: Sandbox encountered a critical error
*
* State transitions:
* - Pending → Running (after creation completes)
* - Running → Pausing (when pause is requested)
* - Pausing → Paused (pause operation completes)
* - Paused → Resuming (when resume is requested)
* - Resuming → Running (when resume operation completes)
* - Running/Paused → Stopping (when kill is requested or TTL expires)
* - Stopping → Terminated (kill/timeout operation completes)
* - Pending/Running/Paused/Resuming → Failed (on error)
*
* Note: New state values may be added in future versions.
* Clients should handle unknown state values gracefully.
*/
SandboxState: string;
/** @description Detailed status information with lifecycle state and transition details */
SandboxStatus: {
/** @description Current lifecycle state of the sandbox */
state: components["schemas"]["SandboxState"];
/**
* @description Short machine-readable reason code for the current state.
* Examples: "user_delete", "ttl_expiry", "provision_timeout", "runtime_error"
*/
reason?: string;
/** @description Human-readable message describing the current state or reason for state transition */
message?: string;
/**
* Format: date-time
* @description Timestamp of the last state transition
*/
lastTransitionAt?: string;
};
/**
* @description Container image specification for sandbox provisioning.
*
* Supports public registry images and private registry images with authentication.
*/
ImageSpec: {
/**
* @description Container image URI in standard format.
*
* Examples:
* - "python:3.11" (Docker Hub)
* - "ubuntu:22.04"
* - "gcr.io/my-project/model-server:v1.0"
* - "private-registry.company.com:5000/app:latest"
*/
uri: string;
/** @description Registry authentication credentials (required for private registries) */
auth?: {
/** @description Registry username or service account */
username?: string;
/** @description Registry password or authentication token */
password?: string;
};
};
/**
* @description Runtime platform constraint used for scheduling/provisioning.
*
* This field is independent from `image` and expresses the expected target
* OS and CPU architecture for sandbox execution.
*
* Behavioral notes:
* - If omitted, the runtime applies its own default platform selection behavior.
* For Docker, requests are created without an explicit platform override.
* For Kubernetes, no `kubernetes.io/os` or `kubernetes.io/arch` constraint
* is injected unless provided by request or workload template.
* - If provided and cannot be satisfied by runtime/template/pool constraints,
* request must fail explicitly.
*/
PlatformSpec: {
/**
* @description Target operating system (for example `linux` or `windows`).
* @example linux
* @enum {string}
*/
os: "linux" | "windows";
/**
* @description Target CPU architecture (for example `amd64` or `arm64`).
* @example arm64
* @enum {string}
*/
arch: "amd64" | "arm64";
};
/**
* @description JSON Merge Patch (RFC 7396) request body for updating sandbox metadata.
*
* The request body is the metadata object itself:
* - Present keys with non-null values add or replace
* - Keys with `null` values are deleted
* - Absent keys are left unchanged
*
* Keys with the `opensandbox.io/` prefix are reserved and rejected.