-
Notifications
You must be signed in to change notification settings - Fork 860
feat: add Volume CRUD operations to SDKs #1126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5729ee9
0fd233e
58937ec
3e8da70
0f4ae74
a900de1
c1e27c3
c8da307
90fd51b
071a120
e9dce6e
99afdaa
2da6c7d
b9223ef
697279e
e06b84f
fbc4fef
0ba61f7
a80e430
eb2a971
8c1bbb1
9fc267a
5b24544
8014702
b5d115c
50bd671
ef03ca8
13215f0
c374963
bf08d4c
e6426a6
25842bb
4ac4d35
6048a77
c80580b
82fcd91
33f1fdc
de5bdbf
788cc9c
5706cef
1f6246e
55ef921
10a6f0f
47b8763
ecc9914
8a9694e
c731f64
d698544
bcc0f2c
7eab33b
c6ffe27
34329ef
c41e78a
3f262f2
84225d3
dc06a49
b784512
759296b
f04efe0
fcfa876
141ec07
3e5b792
55873a4
b2b2fb9
107422b
01701db
25ba304
d690e38
7d16afc
54d48f5
2f07957
07a7bea
e720b99
3aabc4e
3aa01d4
061a350
b67970a
308e339
647bb86
0d424a9
a438207
7465402
fbe8d16
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| '@e2b/python-sdk': minor | ||
| 'e2b': minor | ||
| --- | ||
|
|
||
| added volumes support to the SDKs |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ import { | |
| import { compareVersions } from 'compare-versions' | ||
| import { SandboxNotFoundError, TemplateError } from '../errors' | ||
| import { timeoutToSeconds } from '../utils' | ||
| import type { Volume } from '../volume' | ||
| import type { McpServer as BaseMcpServer } from './mcp' | ||
|
|
||
| /** | ||
|
|
@@ -156,6 +157,16 @@ export interface SandboxOpts extends ConnectionOpts { | |
| */ | ||
| network?: SandboxNetworkOpts | ||
|
|
||
| /** | ||
| * Volume mounts for the sandbox. | ||
| * | ||
| * The keys are mount paths inside the sandbox and the values are either | ||
| * a `Volume` instance or a string representing the volume name. | ||
| * | ||
| * @default undefined | ||
| */ | ||
| volumeMounts?: Record<string, Volume | string> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Making this an array might be a better idea. It is true that you can only mount each path once, but order may matter. For example: You can layer it, as long as you can guarantee the order. In a map, the order cannot be guaranteed.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. current version is better DX, don't think order will be important |
||
|
|
||
| /** | ||
| * Sandbox URL. Used for local development | ||
| */ | ||
|
|
@@ -337,6 +348,11 @@ export interface SandboxInfo { | |
| * Sandbox lifecycle configuration. | ||
| */ | ||
| lifecycle?: SandboxInfoLifecycle | ||
|
|
||
| /** | ||
| * Volume mounts for the sandbox. | ||
| */ | ||
| volumeMounts?: Array<{ name: string; path: string }> | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -602,6 +618,7 @@ export class SandboxApi { | |
| } | ||
| : undefined, | ||
| sandboxDomain: res.data.domain || undefined, | ||
| volumeMounts: res.data.volumeMounts ?? [], | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -775,6 +792,15 @@ export class SandboxApi { | |
| : {}), | ||
| } | ||
|
|
||
| if (opts?.volumeMounts) { | ||
| body.volumeMounts = Object.entries(opts.volumeMounts).map( | ||
| ([mountPath, vol]) => ({ | ||
| name: typeof vol === 'string' ? vol : vol.name, | ||
| path: mountPath, | ||
| }) | ||
| ) | ||
| } | ||
|
|
||
| const res = await client.api.POST('/sandboxes', { | ||
| body, | ||
| signal: config.getSignal(opts?.requestTimeoutMs), | ||
|
|
@@ -959,6 +985,7 @@ export class SandboxPaginator extends BasePaginator<SandboxInfo> { | |
| cpuCount: sandbox.cpuCount, | ||
| memoryMB: sandbox.memoryMB, | ||
| envdVersion: sandbox.envdVersion, | ||
| volumeMounts: sandbox.volumeMounts ?? [], | ||
| }) | ||
| ) | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.