Daytona
Section titled “Daytona”Daytona class for Daytona SDK.
Constructors
Section titled “Constructors”new Daytona()
Section titled “new Daytona()”def initialize(config = Config.new)Parameters:
configDaytona:Config - Configuration options. Defaults to Daytona::Config.new
Returns:
Daytona- a new instance of Daytona
Methods
Section titled “Methods”config()
Section titled “config()”def config()Returns:
Daytona:Config
api_client()
Section titled “api_client()”def api_client()Returns:
DaytonaApiClient
sandbox_api()
Section titled “sandbox_api()”def sandbox_api()Returns:
DaytonaApiClient:SandboxApi
volume()
Section titled “volume()”def volume()Returns:
Daytona:VolumeService
secret()
Section titled “secret()”def secret()Returns:
Daytona:SecretService
warm_pool()
Section titled “warm_pool()”def warm_pool()Returns:
Daytona:WarmPoolService
object_storage_api()
Section titled “object_storage_api()”def object_storage_api()Returns:
DaytonaApiClient:ObjectStorageApi
snapshots_api()
Section titled “snapshots_api()”def snapshots_api()Returns:
DaytonaApiClient:SnapshotsApi
snapshot()
Section titled “snapshot()”def snapshot()Returns:
Daytona:SnapshotService
close()
Section titled “close()”def close()Shuts down OTel providers, flushing any pending telemetry data.
Returns:
void
create()
Section titled “create()”def create(params = nil, timeout: Sandbox::DEFAULT_TIMEOUT, on_snapshot_create_logs: nil)Creates a sandbox with the specified parameters
Parameters:
paramsDaytona:CreateSandboxFromSnapshotParams, Daytona:CreateSandboxFromImageParams, Nil - Sandbox creation parameterstimeoutNumeric - Maximum time in seconds to wait for the Sandbox to be created and started (defaults to 60 s). Sandbox::NO_TIMEOUT (0) means no timeout.on_snapshot_create_logsProc -
Returns:
Daytona:Sandbox- The created sandbox
Raises:
Daytona:Sdk:Error- If timeout, auto_stop_interval, auto_pause_interval, auto_archive_interval, or ttl_minutes is negative, if queue_timeout is not a positive integer, or if auto_stop_interval and auto_pause_interval are both non-zeroDaytona:Sdk:TimeoutError- If the Sandbox is not started within timeout. When the Sandbox was already created, the error’s sandbox_id names it: it may still be starting, so fetch it with #get and remove it with #delete. When the create request itself timed out, sandbox_id is nil, but the API may still have created the Sandbox: find it by its labels with #list (it can take a few seconds to show up)Daytona:Sdk:QueueTimeoutError- If the API destroyed the Sandbox because it waited longer than queue_timeout for a runnerDaytona:Sdk:SpotEvictedError- If the Sandbox was destroyed by spot preemption while starting
delete()
Section titled “delete()”def delete(sandbox, wait: false)Deletes a Sandbox.
Parameters:
sandboxDaytona:Sandbox -waitBoolean - When +true+, block until the Sandbox is destroyed.
Returns:
void
def get(id)Gets a Sandbox by its ID.
Parameters:
idString -
Returns:
Daytona:Sandbox
Raises:
Daytona:Sdk:Error-
list()
Section titled “list()”def list(query = nil)Iterates over Sandboxes matching the given query.
Parameters:
queryDaytona:ListSandboxesQuery, nil - Optional filters, sorting, and per-page size.
Returns:
Enumerator\<Daytona:Sandbox\>
Raises:
Daytona:Sdk:Error-
Examples:
daytona.list(Daytona::ListSandboxesQuery.new(labels: { 'env' => 'dev' })).each do |sandbox| puts sandbox.idendstart()
Section titled “start()”def start(sandbox, timeout = Sandbox::DEFAULT_TIMEOUT)Starts a Sandbox and waits for it to be ready.
Parameters:
sandboxDaytona:Sandbox -timeoutNumeric - Maximum wait time in seconds (defaults to 60 s).
Returns:
void
stop()
Section titled “stop()”def stop(sandbox, timeout = Sandbox::DEFAULT_TIMEOUT)Stops a Sandbox and waits for it to be stopped.
Parameters:
sandboxDaytona:Sandbox -timeoutNumeric - Maximum wait time in seconds (defaults to 60 s).
Returns:
void