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.
VolumeService
class VolumeService()Service for managing Daytona Volumes. Can be used to list, get, create and delete Volumes.
VolumeService.list
def list() -> list[Volume]List all Volumes.
Returns:
list[Volume]- List of all Volumes.
Example:
daytona = Daytona()volumes = daytona.volume.list()for volume in volumes: print(f"{volume.name} ({volume.id})")VolumeService.get
@with_instrumentation()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:
daytona = Daytona()volume = daytona.volume.get("test-volume-name", create=True)print(f"{volume.name} ({volume.id})")VolumeService.create
@with_instrumentation()def create(name: str) -> VolumeCreate a new Volume.
Arguments:
namestr - Name of the Volume to create.
Returns:
Volume- The Volume object.
Example:
daytona = Daytona()volume = daytona.volume.create("test-volume")print(f"{volume.name} ({volume.id}); state: {volume.state}")VolumeService.delete
@with_instrumentation()def delete(volume: Volume) -> NoneDelete a Volume.
Arguments:
volumeVolume - Volume to delete.
Example:
daytona = Daytona()volume = daytona.volume.get("test-volume")daytona.volume.delete(volume)print("Volume deleted")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.