コンテンツにスキップ
View as Markdown

このコンテンツはまだ日本語訳がありません。

SnapshotService

Service for managing Daytona Snapshots.

Provides operations to create, list, retrieve, and delete snapshots.

Methods

create()

public Snapshot create(String name, String imageName)

Creates a snapshot from an existing image reference.

Parameters:

  • name String - snapshot name
  • imageName String - source image name or tag

Returns:

  • Snapshot - created Snapshot

Throws:

  • io.daytona.sdk.exception.DaytonaException - if the API request fails

create()

public Snapshot create(String name, Image image, Consumer<String> onLogs)

Creates a snapshot from a declarative Image with optional build log streaming.

Parameters:

  • name String - snapshot name
  • image Image - declarative image definition
  • onLogs Consumer<String> - callback for build log lines; null to skip streaming

Returns:

  • Snapshot - created Snapshot in active or error state

Throws:

  • DaytonaException - if the API request fails or the build fails

create()

public Snapshot create(String name, Image image, io.daytona.sdk.model.Resources resources, Consumer<String> onLogs)

Creates a snapshot from a declarative Image with resources and optional build log streaming.

Parameters:

  • name String - snapshot name
  • image Image - declarative image definition
  • resources io.daytona.sdk.model.Resources - CPU/GPU/memory/disk resources; null for defaults
  • onLogs Consumer<String> - callback for build log lines; null to skip streaming

Returns:

  • Snapshot - created Snapshot in active or error state

Throws:

  • DaytonaException - if the API request fails or the build fails

list()

public PaginatedSnapshots list(Integer page, Integer limit)

Lists snapshots with pagination.

Parameters:

  • page Integer - page number starting from 1; defaults to 1 when null
  • limit Integer - maximum number of items per page; defaults to 10 when null

Returns:

  • PaginatedSnapshots - paginated snapshot result

Throws:

  • io.daytona.sdk.exception.DaytonaException - if the API request fails

get()

public Snapshot get(String nameOrId)

Retrieves a snapshot by name or ID.

Parameters:

  • nameOrId String - snapshot name or identifier

Returns:

  • Snapshot - matching Snapshot

Throws:

  • io.daytona.sdk.exception.DaytonaException - if no snapshot is found or request fails

delete()

public void delete(String id)

Deletes a snapshot by ID.

Parameters:

  • id String - snapshot identifier

Throws:

  • io.daytona.sdk.exception.DaytonaException - if deletion fails