Class: Daytona::Snapshot

Inherits:
Object
  • Object
show all
Defined in:
lib/daytona/common/snapshot.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(snapshot_dto) ⇒ Snapshot

Returns a new instance of Snapshot.

Parameters:

  • snapshot_dto (DaytonaApiClient::SnapshotDto)

    The snapshot DTO from the API



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/daytona/common/snapshot.rb', line 90

def initialize(snapshot_dto) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
  @id = snapshot_dto.id
  @organization_id = snapshot_dto.organization_id
  @general = snapshot_dto.general
  @name = snapshot_dto.name
  @image_name = snapshot_dto.image_name
  @state = snapshot_dto.state
  @size = snapshot_dto.size
  @entrypoint = snapshot_dto.entrypoint
  @cpu = snapshot_dto.cpu
  @gpu = snapshot_dto.gpu
  @mem = snapshot_dto.mem
  @disk = snapshot_dto.disk
  @error_reason = snapshot_dto.error_reason
  @created_at = snapshot_dto.created_at
  @updated_at = snapshot_dto.updated_at
  @last_used_at = snapshot_dto.last_used_at
  @build_info = snapshot_dto.build_info
end

Instance Attribute Details

#build_infoDaytonaApiClient::BuildInfo? (readonly)

Returns Build information for the snapshot.

Returns:

  • (DaytonaApiClient::BuildInfo, nil)

    Build information for the snapshot



87
88
89
# File 'lib/daytona/common/snapshot.rb', line 87

def build_info
  @build_info
end

#cpuFloat (readonly)

Returns CPU of the Snapshot.

Returns:

  • (Float)

    CPU of the Snapshot



63
64
65
# File 'lib/daytona/common/snapshot.rb', line 63

def cpu
  @cpu
end

#created_atString (readonly)

Returns Timestamp when the Snapshot was created.

Returns:

  • (String)

    Timestamp when the Snapshot was created



78
79
80
# File 'lib/daytona/common/snapshot.rb', line 78

def created_at
  @created_at
end

#diskFloat (readonly)

Returns Disk of the Snapshot in GiB.

Returns:

  • (Float)

    Disk of the Snapshot in GiB



72
73
74
# File 'lib/daytona/common/snapshot.rb', line 72

def disk
  @disk
end

#entrypointArray<String>? (readonly)

Returns Entrypoint of the Snapshot.

Returns:

  • (Array<String>, nil)

    Entrypoint of the Snapshot



60
61
62
# File 'lib/daytona/common/snapshot.rb', line 60

def entrypoint
  @entrypoint
end

#error_reasonString? (readonly)

Returns Error reason of the Snapshot.

Returns:

  • (String, nil)

    Error reason of the Snapshot



75
76
77
# File 'lib/daytona/common/snapshot.rb', line 75

def error_reason
  @error_reason
end

#generalBoolean? (readonly)

Returns Whether the Snapshot is general.

Returns:

  • (Boolean, nil)

    Whether the Snapshot is general



45
46
47
# File 'lib/daytona/common/snapshot.rb', line 45

def general
  @general
end

#gpuFloat (readonly)

Returns GPU of the Snapshot.

Returns:

  • (Float)

    GPU of the Snapshot



66
67
68
# File 'lib/daytona/common/snapshot.rb', line 66

def gpu
  @gpu
end

#idString (readonly)

Returns Unique identifier for the Snapshot.

Returns:

  • (String)

    Unique identifier for the Snapshot



39
40
41
# File 'lib/daytona/common/snapshot.rb', line 39

def id
  @id
end

#image_nameString (readonly)

Returns Name of the Image of the Snapshot.

Returns:

  • (String)

    Name of the Image of the Snapshot



51
52
53
# File 'lib/daytona/common/snapshot.rb', line 51

def image_name
  @image_name
end

#last_used_atString? (readonly)

Returns Timestamp when the Snapshot was last used.

Returns:

  • (String, nil)

    Timestamp when the Snapshot was last used



84
85
86
# File 'lib/daytona/common/snapshot.rb', line 84

def last_used_at
  @last_used_at
end

#memFloat (readonly)

Returns Memory of the Snapshot in GiB.

Returns:

  • (Float)

    Memory of the Snapshot in GiB



69
70
71
# File 'lib/daytona/common/snapshot.rb', line 69

def mem
  @mem
end

#nameString (readonly)

Returns Name of the Snapshot.

Returns:

  • (String)

    Name of the Snapshot



48
49
50
# File 'lib/daytona/common/snapshot.rb', line 48

def name
  @name
end

#organization_idString? (readonly)

Returns Organization ID of the Snapshot.

Returns:

  • (String, nil)

    Organization ID of the Snapshot



42
43
44
# File 'lib/daytona/common/snapshot.rb', line 42

def organization_id
  @organization_id
end

#sizeFloat? (readonly)

Returns Size of the Snapshot.

Returns:

  • (Float, nil)

    Size of the Snapshot



57
58
59
# File 'lib/daytona/common/snapshot.rb', line 57

def size
  @size
end

#stateString (readonly)

Returns State of the Snapshot.

Returns:

  • (String)

    State of the Snapshot



54
55
56
# File 'lib/daytona/common/snapshot.rb', line 54

def state
  @state
end

#updated_atString (readonly)

Returns Timestamp when the Snapshot was last updated.

Returns:

  • (String)

    Timestamp when the Snapshot was last updated



81
82
83
# File 'lib/daytona/common/snapshot.rb', line 81

def updated_at
  @updated_at
end

Class Method Details

.from_dto(dto) ⇒ Daytona::Snapshot

Creates a Snapshot instance from a SnapshotDto

Parameters:

  • dto (DaytonaApiClient::SnapshotDto)

    The snapshot DTO from the API

Returns:



114
# File 'lib/daytona/common/snapshot.rb', line 114

def self.from_dto(dto) = new(dto)