Volume
Section titled “Volume”class Volume(VolumeDto)Represents a Daytona Volume which is a shared storage volume for Sandboxes.
Attributes:
idstr - Unique identifier for the Volume.namestr - Name of the Volume.organization_idstr - Organization ID of the Volume.statestr - State of the Volume.created_atstr - Date and time when the Volume was created.updated_atstr - Date and time when the Volume was last updated.last_used_atstr - Date and time when the Volume was last used.
AsyncVolumeService
Section titled “AsyncVolumeService”class AsyncVolumeService()Service for managing Daytona Volumes. Can be used to list, get, create and delete Volumes.
AsyncVolumeService.list
Section titled “AsyncVolumeService.list”async def list() -> list[Volume]List all Volumes.
Returns:
list[Volume]- List of all Volumes.
Example:
async with AsyncDaytona() as daytona: volumes = await daytona.volume.list() for volume in volumes: print(f"{volume.name} ({volume.id})")AsyncVolumeService.get
Section titled “AsyncVolumeService.get”@with_instrumentation()async def get(name: str, create: bool = False) -> VolumeGet a Volume by name.
Arguments:
namestr - Name of the Volume to get.createbool - If True, create a new Volume if it doesn’t exist.
Returns:
Volume- The Volume object.
Example:
async with AsyncDaytona() as daytona: volume = await daytona.volume.get("test-volume-name", create=True) print(f"{volume.name} ({volume.id})")AsyncVolumeService.create
Section titled “AsyncVolumeService.create”@with_instrumentation()async def create(name: str) -> VolumeCreate a new Volume.
Arguments:
namestr - Name of the Volume to create.
Returns:
Volume- The Volume object.
Example:
async with AsyncDaytona() as daytona: volume = await daytona.volume.create("test-volume") print(f"{volume.name} ({volume.id}); state: {volume.state}")AsyncVolumeService.delete
Section titled “AsyncVolumeService.delete”@with_instrumentation()async def delete(volume: Volume) -> NoneDelete a Volume.
Arguments:
volumeVolume - Volume to delete.
Example:
async with AsyncDaytona() as daytona: volume = await daytona.volume.get("test-volume") await daytona.volume.delete(volume) print("Volume deleted")VolumeMount
Section titled “VolumeMount”class VolumeMount(ApiVolumeMount, AsyncApiVolumeMount)Represents a Volume mount configuration for a Sandbox.
Attributes:
volume_idstr - ID of the volume to mount.mount_pathstr - Path where the volume will be mounted in the sandbox.subpathstr | None - Optional S3 subpath/prefix within the volume to mount. When specified, only this prefix will be accessible. When omitted, the entire volume is mounted.