Class: Bsdkrun::SnapshotInfo
- Inherits:
-
Data
- Object
- Data
- Bsdkrun::SnapshotInfo
- Defined in:
- lib/bsdkrun/types.rb
Overview
A machine snapshot: one machine's disk state, captured under a name.
A copy-on-write clone rather than a memory image — the files the guest wrote, not what it was executing. Client#branch boots a new machine from one; Client#restore puts one back.
Instance Attribute Summary collapse
-
#cpus ⇒ Object
readonly
Returns the value of attribute cpus.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#machine_id ⇒ Object
readonly
Returns the value of attribute machine_id.
-
#machine_name ⇒ Object
readonly
Returns the value of attribute machine_name.
-
#mem ⇒ Object
readonly
Returns the value of attribute mem.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#ports ⇒ Object
readonly
Returns the value of attribute ports.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Class Method Summary collapse
-
.from_graphql(s) ⇒ SnapshotInfo
Map a GraphQL
Snapshot(camelCase) to a typed instance. -
.from_row(row) ⇒ SnapshotInfo
Map a
bsdkrun snapshots --jsonrow (snake_case).
Instance Attribute Details
#cpus ⇒ Object (readonly)
Returns the value of attribute cpus
111 112 113 |
# File 'lib/bsdkrun/types.rb', line 111 def cpus @cpus end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at
111 112 113 |
# File 'lib/bsdkrun/types.rb', line 111 def created_at @created_at end |
#description ⇒ Object (readonly)
Returns the value of attribute description
111 112 113 |
# File 'lib/bsdkrun/types.rb', line 111 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id
111 112 113 |
# File 'lib/bsdkrun/types.rb', line 111 def id @id end |
#image ⇒ Object (readonly)
Returns the value of attribute image
111 112 113 |
# File 'lib/bsdkrun/types.rb', line 111 def image @image end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind
111 112 113 |
# File 'lib/bsdkrun/types.rb', line 111 def kind @kind end |
#machine_id ⇒ Object (readonly)
Returns the value of attribute machine_id
111 112 113 |
# File 'lib/bsdkrun/types.rb', line 111 def machine_id @machine_id end |
#machine_name ⇒ Object (readonly)
Returns the value of attribute machine_name
111 112 113 |
# File 'lib/bsdkrun/types.rb', line 111 def machine_name @machine_name end |
#mem ⇒ Object (readonly)
Returns the value of attribute mem
111 112 113 |
# File 'lib/bsdkrun/types.rb', line 111 def mem @mem end |
#name ⇒ Object (readonly)
Returns the value of attribute name
111 112 113 |
# File 'lib/bsdkrun/types.rb', line 111 def name @name end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent
111 112 113 |
# File 'lib/bsdkrun/types.rb', line 111 def parent @parent end |
#path ⇒ Object (readonly)
Returns the value of attribute path
111 112 113 |
# File 'lib/bsdkrun/types.rb', line 111 def path @path end |
#ports ⇒ Object (readonly)
Returns the value of attribute ports
111 112 113 |
# File 'lib/bsdkrun/types.rb', line 111 def ports @ports end |
#size ⇒ Object (readonly)
Returns the value of attribute size
111 112 113 |
# File 'lib/bsdkrun/types.rb', line 111 def size @size end |
Class Method Details
.from_graphql(s) ⇒ SnapshotInfo
Map a GraphQL Snapshot (camelCase) to a typed instance.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/bsdkrun/types.rb', line 118 def self.from_graphql(s) new( id: s["id"].to_s, name: s["name"].to_s, machine_id: s["machineId"].to_s, machine_name: (s["machineName"] || "").to_s, kind: s["kind"].to_s, image: (s["image"] || "").to_s, path: (s["path"] || "").to_s, parent: s["parent"], description: (s["description"] || "").to_s, cpus: s["cpus"].to_i, mem: s["mem"].to_i, ports: (s["ports"] || []).map { |p| PortForward.from_row(p) }, size: s["size"], created_at: s["createdAt"].to_i ) end |
.from_row(row) ⇒ SnapshotInfo
Map a bsdkrun snapshots --json row (snake_case).
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/bsdkrun/types.rb', line 140 def self.from_row(row) new( id: row["id"].to_s, name: row["name"].to_s, machine_id: row["machine_id"].to_s, machine_name: (row["machine_name"] || "").to_s, kind: row["kind"].to_s, image: (row["image"] || "").to_s, path: (row["path"] || "").to_s, parent: row["parent"], description: (row["description"] || "").to_s, cpus: row["cpus"].to_i, mem: row["mem"].to_i, ports: (row["ports"] || []).map { |p| PortForward.from_row(p) }, size: row["size"], created_at: row["created_at"].to_i ) end |