Volumes
Persistent volumes you mount into sandboxes, and their files.
Every method shows the same operation in each SDK; pick a language once and every tab on the site follows it.
Volume
Section titled “Volume”One persistent volume; info is what the API last said about it.
Properties
Section titled “Properties”Python exposes these as methods; see below.
| Property | Type | Description |
|---|---|---|
client |
SandboxClient |
Go exposes these as methods; see below.
| Property | Type | Description |
|---|---|---|
client |
| Property | Type | Description |
|---|---|---|
MAX_FILE_BYTES |
int |
The API reads and writes at most this much of one file; mount the volume in a sandbox for larger files. |
create()
Section titled “create()”def create(cls, name: str, *, size_gb: int, idempotency_key: str | None=None, client: 'SandboxClient | None'=None) -> 'Volume'| Parameter | Type | Default |
|---|---|---|
name |
str |
|
size_gb |
int |
|
idempotency_key |
str | None |
None |
client |
'SandboxClient | None' |
None |
Returns 'Volume'
sdk/python/svm/volumes.py:69static async create(name: string, sizeGb: number, options: { idempotencyKey?: string; client?: SandboxClient } = {}): Promise<Volume>| Parameter | Type | Default |
|---|---|---|
name |
string |
|
sizeGb |
number |
|
options |
{ idempotencyKey?: string; client?: SandboxClient } |
{} |
Returns Promise<Volume>
sdk/typescript/src/volume.ts:50Not in the Go SDK’s Volume.
def self.create(name, size_gb:, idempotency_key: nil, client: Client.new)| Parameter | Type | Default |
|---|---|---|
name |
||
size_gb |
||
idempotency_key |
nil |
|
client |
Client.new |
sdk/ruby/lib/svm/volume.rb:28public static Volume create(Client client, String name, int sizeGb, String idempotencyKey)public static Volume create(Client client, String name, int sizeGb)Creates a volume of sizeGb; idempotencyKey (8 to 128 characters) may be null.
| Parameter | Type | Default |
|---|---|---|
client |
Client |
|
name |
String |
|
sizeGb |
int |
|
idempotencyKey |
String |
optional |
Returns Volume
sdk/java/src/main/java/dev/svm/sandbox/Volume.java:74def get(cls, volume_id: str, *, client: 'SandboxClient | None'=None) -> 'Volume'| Parameter | Type | Default |
|---|---|---|
volume_id |
str |
|
client |
'SandboxClient | None' |
None |
Returns 'Volume'
sdk/python/svm/volumes.py:74static async get(volumeId: string, client: SandboxClient = new SandboxClient()): Promise<Volume>| Parameter | Type | Default |
|---|---|---|
volumeId |
string |
|
client |
SandboxClient |
new SandboxClient() |
Returns Promise<Volume>
sdk/typescript/src/volume.ts:55Not in the Go SDK’s Volume.
def self.get(volume_id, client: Client.new)Fetches the volume.
| Parameter | Type | Default |
|---|---|---|
volume_id |
||
client |
Client.new |
sdk/ruby/lib/svm/volume.rb:33public static Volume get(Client client, String volumeId)Fetches the volume volumeId.
| Parameter | Type | Default |
|---|---|---|
client |
Client |
|
volumeId |
String |
Returns Volume
sdk/java/src/main/java/dev/svm/sandbox/Volume.java:84list()
Section titled “list()”def list(cls, *, client: 'SandboxClient | None'=None) -> list['Volume']Every live volume of the team, following pages.
| Parameter | Type | Default |
|---|---|---|
client |
'SandboxClient | None' |
None |
Returns list['Volume']
sdk/python/svm/volumes.py:79static async list(client: SandboxClient = new SandboxClient()): Promise<Volume[]>Every live volume of the team, following pages.
| Parameter | Type | Default |
|---|---|---|
client |
SandboxClient |
new SandboxClient() |
Returns Promise<Volume[]>
sdk/typescript/src/volume.ts:60Not in the Go SDK’s Volume.
def self.list(client: Client.new)Every live volume of the team, following pages.
| Parameter | Type | Default |
|---|---|---|
client |
Client.new |
sdk/ruby/lib/svm/volume.rb:39public static List<Volume> list(Client client)Every live volume of the team, following pages.
| Parameter | Type | Default |
|---|---|---|
client |
Client |
Returns List<Volume>
sdk/java/src/main/java/dev/svm/sandbox/Volume.java:87constructor()
Section titled “constructor()”Not in the Python SDK’s Volume.
constructor(readonly client: SandboxClient, public info: VolumeInfo)| Parameter | Type | Default |
|---|---|---|
client |
SandboxClient |
|
info |
VolumeInfo |
sdk/typescript/src/volume.ts:45Not in the Go SDK’s Volume.
Not in the Ruby SDK’s Volume.
Not in the Java SDK’s Volume.
delete()
Section titled “delete()”Not in the Python SDK’s Volume.
static async delete(volumeId: string, client: SandboxClient = new SandboxClient()): Promise<void>Delete the volume with this id.
| Parameter | Type | Default |
|---|---|---|
volumeId |
string |
|
client |
SandboxClient |
new SandboxClient() |
sdk/typescript/src/volume.ts:72func (v *Volume) Delete(ctx context.Context) errorDelete deletes this volume.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
Returns error
sdk/go/volume.go:106def self.delete(volume_id, client: Client.new)Deletes the volume volume_id (it must not be attached to a sandbox).
| Parameter | Type | Default |
|---|---|---|
volume_id |
||
client |
Client.new |
sdk/ruby/lib/svm/volume.rb:52public static void delete(Client client, String volumeId)public void delete()Deletes the volume volumeId.
| Parameter | Type | Default |
|---|---|---|
client |
Client |
optional |
volumeId |
String |
optional |
sdk/java/src/main/java/dev/svm/sandbox/Volume.java:104exists()
Section titled “exists()”def exists(self, path: str) -> bool| Parameter | Type | Default |
|---|---|---|
path |
str |
Returns bool
sdk/python/svm/volumes.py:113async exists(path: string): Promise<boolean>| Parameter | Type | Default |
|---|---|---|
path |
string |
Returns Promise<boolean>
sdk/typescript/src/volume.ts:97func (v *Volume) Exists(ctx context.Context, path string) (bool, error)Exists says whether path is on the volume.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
Returns (bool, error)
sdk/go/volume.go:158def exists?(path)| Parameter | Type | Default |
|---|---|---|
path |
sdk/ruby/lib/svm/volume.rb:92public boolean exists(String path)| Parameter | Type | Default |
|---|---|---|
path |
String |
Returns boolean
sdk/java/src/main/java/dev/svm/sandbox/Volume.java:143get_info()
Section titled “get_info()”def get_info(self, path: str) -> dict[str, Any]The entry at path (name, kind, size, mode, modified_unix_ms); kind is "file", "dir", "symlink" or "other".
| Parameter | Type | Default |
|---|---|---|
path |
str |
Returns dict[str, Any]
sdk/python/svm/volumes.py:108async getInfo(path: string): Promise<VolumeEntry>One path’s entry (name, kind, size, mode, modification time).
| Parameter | Type | Default |
|---|---|---|
path |
string |
Returns Promise<VolumeEntry>
sdk/typescript/src/volume.ts:93func (v *Volume) GetInfo(ctx context.Context, path string) (VolumeEntry, error)GetInfo describes one path.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
Returns (VolumeEntry, error)
sdk/go/volume.go:151def get_info(path)One entry, as #list_files gives them.
| Parameter | Type | Default |
|---|---|---|
path |
sdk/ruby/lib/svm/volume.rb:88public Entry getInfo(String path)The entry at path.
| Parameter | Type | Default |
|---|---|---|
path |
String |
Returns Entry
sdk/java/src/main/java/dev/svm/sandbox/Volume.java:141id: strProperty (read-only).
id: stringProperty (read-only).
func (v *Volume) ID() stringID is the volume’s id.
Returns string
sdk/go/volume.go:40def idsdk/ruby/lib/svm/volume.rb:63public String id()Returns String
sdk/java/src/main/java/dev/svm/sandbox/Volume.java:109info()
Section titled “info()”Not in the Python SDK’s Volume.
info: VolumeInfoProperty.
func (v *Volume) Info() VolumeInfoInfo is what the API last said about the volume.
Returns VolumeInfo
sdk/go/volume.go:46infoProperty (read-only).
public Info info()What the API last said about this volume.
Returns Info
sdk/java/src/main/java/dev/svm/sandbox/Volume.java:114initialize()
Section titled “initialize()”Not in the Python SDK’s Volume.
Not in the TypeScript SDK’s Volume.
Not in the Go SDK’s Volume.
def initialize(client, info)| Parameter | Type | Default |
|---|---|---|
client |
||
info |
sdk/ruby/lib/svm/volume.rb:23Not in the Java SDK’s Volume.
list_files()
Section titled “list_files()”def list_files(self, path: str='/') -> list[dict[str, Any]]The entries of a directory (name, kind, size, mode, modified_unix_ms, and owner and group when the guest names them); / is the root. kind is the API’s value: "file", "dir", "symlink" or "other".
| Parameter | Type | Default |
|---|---|---|
path |
str |
'/' |
Returns list[dict[str, Any]]
sdk/python/svm/volumes.py:102async listFiles(path = "/"): Promise<VolumeEntry[]>The entries of a directory; / is the volume’s root.
| Parameter | Type | Default |
|---|---|---|
path |
string |
"/" |
Returns Promise<VolumeEntry[]>
sdk/typescript/src/volume.ts:87func (v *Volume) ListFiles(ctx context.Context, path string) ([]VolumeEntry, error)ListFiles lists a directory; “/” is the volume’s root.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
Returns ([]VolumeEntry, error)
sdk/go/volume.go:140def list_files(path = "/")The entries of a directory (“name”, “kind”, “size”, “mode”, “modified_unix_ms”); “/” is the root. “kind” is the API’s value: “file”, “dir”, “symlink” or “other” (never “directory”).
| Parameter | Type | Default |
|---|---|---|
path |
"/" |
sdk/ruby/lib/svm/volume.rb:83public List<Entry> listFiles(String path)public List<Entry> listFiles()The entries of a directory; “/” is the root.
| Parameter | Type | Default |
|---|---|---|
path |
String |
optional |
Returns List<Entry>
sdk/java/src/main/java/dev/svm/sandbox/Volume.java:131make_dir()
Section titled “make_dir()”def make_dir(self, path: str, *, parents: bool=True) -> None| Parameter | Type | Default |
|---|---|---|
path |
str |
|
parents |
bool |
True |
sdk/python/svm/volumes.py:138async makeDir(path: string, options: { parents?: boolean } = {}): Promise<void>| Parameter | Type | Default |
|---|---|---|
path |
string |
|
options |
{ parents?: boolean } |
{} |
sdk/typescript/src/volume.ts:129func (v *Volume) MakeDir(ctx context.Context, path string, parents bool) errorMakeDir makes a directory; with parents, missing parents too, and an existing directory is not an error.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
|
parents |
bool |
Returns error
sdk/go/volume.go:204def make_dir(path, parents: true)| Parameter | Type | Default |
|---|---|---|
path |
||
parents |
true |
sdk/ruby/lib/svm/volume.rb:118public void makeDir(String path, boolean parents)public void makeDir(String path)Makes a directory, and with parents any missing parents.
| Parameter | Type | Default |
|---|---|---|
path |
String |
|
parents |
boolean |
optional |
sdk/java/src/main/java/dev/svm/sandbox/Volume.java:171mount()
Section titled “mount()”def mount(self, path: str, *, subpath: str | None=None, read_only: bool=False) -> dict[str, Any]A volume_mounts entry for Sandbox.create: the volume (or only its subpath directory) at path.
| Parameter | Type | Default |
|---|---|---|
path |
str |
|
subpath |
str | None |
None |
read_only |
bool |
False |
Returns dict[str, Any]
sdk/python/svm/volumes.py:93mount(path: string, options: { subpath?: string; readOnly?: boolean } = {}): VolumeMountA volumeMounts entry: the volume (or only its subpath directory) at path.
| Parameter | Type | Default |
|---|---|---|
path |
string |
|
options |
{ subpath?: string; readOnly?: boolean } |
{} |
Returns VolumeMount
sdk/typescript/src/volume.ts:80func (v *Volume) Mount(path, subpath string, readOnly bool) map[string]anyMount is a CreateSandboxOptions.VolumeMounts entry: the volume, or only its subpath directory when one is given, at path.
| Parameter | Type | Default |
|---|---|---|
path |
string |
|
subpath |
string |
|
readOnly |
bool |
Returns map[string]any
sdk/go/volume.go:129def mount(path, subpath: nil, read_only: false)A volume_mounts entry for Sandbox.create: the volume (or only its subpath directory) at path.
| Parameter | Type | Default |
|---|---|---|
path |
||
subpath |
nil |
|
read_only |
false |
sdk/ruby/lib/svm/volume.rb:75public Map<String, Object> mount(String path, String subpath, boolean readOnly)public Map<String, Object> mount(String path)A volumeMounts entry for Sandbox.create: the volume (or only its subpath directory, null for all) at path.
| Parameter | Type | Default |
|---|---|---|
path |
String |
|
subpath |
String |
optional |
readOnly |
boolean |
optional |
Returns Map<String, Object>
sdk/java/src/main/java/dev/svm/sandbox/Volume.java:117name()
Section titled “name()”name: strProperty (read-only).
name: stringProperty (read-only).
func (v *Volume) Name() stringName is the volume’s name (empty on a handle from Volumes.Handle, which is not fetched).
Returns string
sdk/go/volume.go:43def namesdk/ruby/lib/svm/volume.rb:64public String name()Returns String
sdk/java/src/main/java/dev/svm/sandbox/Volume.java:111read()
Section titled “read()”def read(self, path: str, *, request_timeout: float | None=None) -> bytesThe whole file (at most 64 MiB).
| Parameter | Type | Default |
|---|---|---|
path |
str |
|
request_timeout |
float | None |
None |
Returns bytes
sdk/python/svm/volumes.py:120read(path: string, options: { requestTimeoutMs?: number } = {}): Promise<Uint8Array>The whole file (at most 64 MiB).
| Parameter | Type | Default |
|---|---|---|
path |
string |
|
options |
{ requestTimeoutMs?: number } |
{} |
Returns Promise<Uint8Array>
sdk/typescript/src/volume.ts:108func (v *Volume) Read(ctx context.Context, path string) ([]byte, error)Read reads a whole file (at most 64 MiB).
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
Returns ([]byte, error)
sdk/go/volume.go:171def read(path, request_timeout: nil)The whole file (at most 64 MiB), as a binary String.
| Parameter | Type | Default |
|---|---|---|
path |
||
request_timeout |
nil |
sdk/ruby/lib/svm/volume.rb:100public byte[] read(String path)The whole file (at most 64 MiB).
| Parameter | Type | Default |
|---|---|---|
path |
String |
Returns byte[]
sdk/java/src/main/java/dev/svm/sandbox/Volume.java:154read_text()
Section titled “read_text()”def read_text(self, path: str, encoding: str='utf-8') -> str| Parameter | Type | Default |
|---|---|---|
path |
str |
|
encoding |
str |
'utf-8' |
Returns str
sdk/python/svm/volumes.py:125async readText(path: string): Promise<string>| Parameter | Type | Default |
|---|---|---|
path |
string |
Returns Promise<string>
sdk/typescript/src/volume.ts:114func (v *Volume) ReadText(ctx context.Context, path string) (string, error)ReadText reads a whole file (at most 64 MiB) as text.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
Returns (string, error)
sdk/go/volume.go:176def read_text(path)| Parameter | Type | Default |
|---|---|---|
path |
sdk/ruby/lib/svm/volume.rb:104public String readText(String path)| Parameter | Type | Default |
|---|---|---|
path |
String |
Returns String
sdk/java/src/main/java/dev/svm/sandbox/Volume.java:158remove()
Section titled “remove()”def remove(self, path: str, *, recursive: bool=False) -> None| Parameter | Type | Default |
|---|---|---|
path |
str |
|
recursive |
bool |
False |
sdk/python/svm/volumes.py:156async remove(path: string, options: { recursive?: boolean } = {}): Promise<void>| Parameter | Type | Default |
|---|---|---|
path |
string |
|
options |
{ recursive?: boolean } |
{} |
sdk/typescript/src/volume.ts:145func (v *Volume) Remove(ctx context.Context, path string, recursive bool) errorRemove removes a file or directory; a non-empty directory needs recursive.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
|
recursive |
bool |
Returns error
sdk/go/volume.go:231def remove(path, recursive: false)| Parameter | Type | Default |
|---|---|---|
path |
||
recursive |
false |
sdk/ruby/lib/svm/volume.rb:132public void remove(String path, boolean recursive)public void remove(String path)Removes a file, or a directory (with recursive, and everything in it).
| Parameter | Type | Default |
|---|---|---|
path |
String |
|
recursive |
boolean |
optional |
sdk/java/src/main/java/dev/svm/sandbox/Volume.java:203update_metadata()
Section titled “update_metadata()”def update_metadata(self, path: str, *, mode: int | None=None, owner: str | None=None, group: str | None=None) -> dict[str, Any]Change a file’s or directory’s permission bits (mode, a number: 0o644), owner and group (names or numeric ids); only what is passed changes. Returns the entry afterwards. A path that does not exist is NotFoundError and a symlink is refused. At least one of the three is required.
| Parameter | Type | Default |
|---|---|---|
path |
str |
|
mode |
int | None |
None |
owner |
str | None |
None |
group |
str | None |
None |
Returns dict[str, Any]
Raises NotFoundError
sdk/python/svm/volumes.py:141async updateMetadata(path: string, options: { mode?: number; owner?: string; group?: string }): Promise<VolumeEntry>Change a file’s or directory’s permission bits (mode, a number: 0o644), owner and group (names or numeric ids); only what is passed changes. Resolves to the entry afterwards. A path that does not exist is a NotFoundError and a symlink is refused. At least one of the three is required.
| Parameter | Type | Default |
|---|---|---|
path |
string |
|
options |
{ mode?: number; owner?: string; group?: string } |
Returns Promise<VolumeEntry>
Raises NotFoundError
sdk/typescript/src/volume.ts:136func (v *Volume) UpdateMetadata(ctx context.Context, path string, update VolumeMetadataUpdate) (VolumeEntry, error)UpdateMetadata changes a file’s or directory’s mode, owner and group; only what the update sets changes. It returns the entry afterwards. A path that does not exist is a NOT_FOUND *APIError and a symlink is refused.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
|
update |
VolumeMetadataUpdate |
Returns (VolumeEntry, error)
Raises APIError
sdk/go/volume.go:211def update_metadata(path, mode: nil, owner: nil, group: nil)Changes a file’s or directory’s permission bits (mode, an Integer: 0o644), owner and group (names or numeric ids); only what is passed changes. Returns the entry afterwards, as #get_info does. A path that does not exist is a NotFoundError and a symlink is refused. At least one of the three is required.
| Parameter | Type | Default |
|---|---|---|
path |
||
mode |
nil |
|
owner |
nil |
|
group |
nil |
Raises NotFoundError
sdk/ruby/lib/svm/volume.rb:126public Entry updateMetadata(String path, Metadata update)Changes a file’s or directory’s mode, owner and group, and returns the entry afterwards. A path that does not exist is a not-found ApiException and a symlink is refused.
| Parameter | Type | Default |
|---|---|---|
path |
String |
|
update |
Metadata |
Returns Entry
sdk/java/src/main/java/dev/svm/sandbox/Volume.java:193write()
Section titled “write()”def write(self, path: str, data: bytes | str, *, request_timeout: float | None=None) -> intReplace the file with data (at most 64 MiB), making missing parent directories; returns the bytes written. The write is sealed into the volume before this returns.
| Parameter | Type | Default |
|---|---|---|
path |
str |
|
data |
bytes | str |
|
request_timeout |
float | None |
None |
Returns int
sdk/python/svm/volumes.py:128async write(path: string, data: Uint8Array | string, options: { requestTimeoutMs?: number } = {}): Promise<number>Replace the file with data (at most 64 MiB), making missing parents; resolves to the bytes written once the write is sealed into the volume.
| Parameter | Type | Default |
|---|---|---|
path |
string |
|
data |
Uint8Array | string |
|
options |
{ requestTimeoutMs?: number } |
{} |
Returns Promise<number>
sdk/typescript/src/volume.ts:118func (v *Volume) Write(ctx context.Context, path string, data []byte) (int64, error)Write replaces a file with data (at most 64 MiB), making missing parent directories, and returns once the write is sealed into the volume.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
path |
string |
|
data |
[]byte |
Returns (int64, error)
sdk/go/volume.go:183def write(path, data, request_timeout: nil)Replaces the file with data (at most 64 MiB), making missing parent directories; returns the bytes written. The write is sealed into the volume before this returns.
| Parameter | Type | Default |
|---|---|---|
path |
||
data |
||
request_timeout |
nil |
sdk/ruby/lib/svm/volume.rb:110public long write(String path, byte[] data)public long write(String path, String text)Replaces the file with data (at most 64 MiB), making missing parent directories; returns the bytes written.
| Parameter | Type | Default |
|---|---|---|
path |
String |
|
data |
byte[] |
Returns long
sdk/java/src/main/java/dev/svm/sandbox/Volume.java:161