Volume
class Volume(VolumeDto)
Represents a Daytona Volume which is a shared storage volume for Sandboxes.
Attributes:
id
StrictStr - Unique identifier for the Volume.name
StrictStr - Name of the Volume.organization_id
StrictStr - Organization ID of the Volume.state
StrictStr - State of the Volume.created_at
StrictStr - Date and time when the Volume was created.updated_at
StrictStr - Date and time when the Volume was last updated.last_used_at
StrictStr - 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
def get(name: str, create: bool = False) -> Volume
Get a Volume by name.
Arguments:
name
str - Name of the Volume to get.create
bool - 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
def create(name: str) -> Volume
Create a new Volume.
Arguments:
name
str - 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
def delete(volume: Volume) -> None
Delete a Volume.
Arguments:
volume
Volume - Volume to delete.
Example:
daytona = Daytona()volume = daytona.volume.get("test-volume")daytona.volume.delete(volume)print("Volume deleted")