SnapshotsClient
Source: leap0/_sync/snapshots.py
Signature
Section titled “Signature”SnapshotsClient(transport: Transport, *, sandbox_factory: SandboxFactory[Sandbox, SnapshotSandboxT] | None = None)Overview
Section titled “Overview”Create, resume, and delete sandbox snapshots.
A snapshot captures the full state of a running sandbox so it can be restored later.
Use snapshots when you want a reusable checkpoint of an initialized sandbox environment.
Attributes: None.
Methods
Section titled “Methods”create
Section titled “create”create(sandbox: SandboxRef, *, name: str | None = None, http_timeout: float | None = None) -> SnapshotCreate a snapshot of a running sandbox without stopping it.
Args: sandbox: Sandbox ID or object to snapshot. name: Optional snapshot name. Auto-generated if omitted.
http_timeout: Optional HTTP request timeout in seconds for this SDK call.
Args: sandbox: Sandbox ID or object to pause. name: Optional snapshot name. Auto-generated if omitted.
http_timeout: Optional HTTP request timeout in seconds for this SDK call. Returns: Snapshot: Created snapshot metadata.
Returns: Snapshot: Snapshot metadata including ID and optional name.
pause(sandbox: SandboxRef, *, name: str | None = None, http_timeout: float | None = None) -> SnapshotPause a running sandbox and create a snapshot in one step.
The sandbox is stopped after the snapshot is taken.
Args: sandbox: Sandbox ID or object. name: Name used by this operation. http_timeout: Optional HTTP request timeout in seconds for this SDK call.
Returns: object: Result returned by this operation.
resume
Section titled “resume”resume(*, snapshot_name: str, auto_pause: bool = False, timeout_min: int | None = None, network_policy: NetworkPolicyDict | None = None, http_timeout: float | None = None) -> SnapshotSandboxT | SandboxRestore a sandbox from a snapshot.
Args: snapshot_name: Name of the snapshot to restore. auto_pause: Automatically pause the restored sandbox on timeout. timeout_min: Sandbox timeout in minutes. network_policy: Override the network policy from the snapshot.
http_timeout: Optional HTTP request timeout in seconds for this SDK call.
Args: http_timeout: Optional HTTP request timeout in seconds for this SDK call.
Returns: Sandbox: Newly resumed sandbox.
delete
Section titled “delete”delete(snapshot: SnapshotRef, http_timeout: float | None = None) -> NoneDelete a snapshot.
Args: snapshot: Parameter for this operation. http_timeout: Optional HTTP request timeout in seconds for this SDK call.