このコンテンツはまだ日本語訳がありません。
SnapshotService
SnapshotService class for Daytona SDK.
Constructors
new SnapshotService()
def initialize(snapshots_api:, object_storage_api:, default_region_id:)Parameters:
snapshots_apiDaytonaApiClient:SnapshotsApi - The snapshots API clientobject_storage_apiDaytonaApiClient:ObjectStorageApi - The object storage API clientdefault_region_idString, nil - Default region ID for snapshot creation
Returns:
SnapshotService- a new instance of SnapshotService
Methods
list()
def list(page:, limit:)List all Snapshots.
Parameters:
pageInteger, Nil -limitInteger, Nil -
Returns:
Daytona:PaginatedResource- Paginated list of all Snapshots
Raises:
Daytona:Sdk:Error-
Examples:
daytona = Daytona::Daytona.newresponse = daytona.snapshot.list(page: 1, limit: 10)snapshots.items.each { |snapshot| puts "#{snapshot.name} (#{snapshot.image_name})" }delete()
def delete(snapshot)Delete a Snapshot.
Parameters:
snapshotDaytona:Snapshot - Snapshot to delete
Returns:
void
Examples:
daytona = Daytona::Daytona.newsnapshot = daytona.snapshot.get("demo")daytona.snapshot.delete(snapshot)puts "Snapshot deleted"get()
def get(name)Get a Snapshot by name.
Parameters:
nameString - Name of the Snapshot to get
Returns:
Daytona:Snapshot- The Snapshot object
Examples:
daytona = Daytona::Daytona.newsnapshot = daytona.snapshot.get("demo")puts "#{snapshot.name} (#{snapshot.image_name})"create()
def create(params, on_logs:)Creates and registers a new snapshot from the given Image definition.
Parameters:
paramsDaytona:CreateSnapshotParams - Parameters for snapshot creationon_logsProc, Nil - Callback proc handling snapshot creation logs
Returns:
Daytona:Snapshot- The created snapshot
Examples:
image = Image.debianSlim('3.12').pipInstall('numpy')params = CreateSnapshotParams.new(name: 'my-snapshot', image: image)snapshot = daytona.snapshot.create(params) do |chunk| print chunkendactivate()
def activate(snapshot)Activate a snapshot
Parameters:
snapshotDaytona:Snapshot - The snapshot instance
Returns:
Daytona:Snapshot