Class: Bsdkrun::DockerStatus

Inherits:
Data
  • Object
show all
Defined in:
lib/bsdkrun/types.rb

Overview

The Docker engine VM: whether it is up, and how to reach it.

bsdkrun runs one docker:dind microVM and serves its API on a host unix socket, so the host's own docker CLI drives the same engine.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#api_portObject (readonly)

Returns the value of attribute api_port

Returns:

  • (Object)

    the current value of api_port



211
212
213
# File 'lib/bsdkrun/types.rb', line 211

def api_port
  @api_port
end

#containersObject (readonly)

Returns the value of attribute containers

Returns:

  • (Object)

    the current value of containers



211
212
213
# File 'lib/bsdkrun/types.rb', line 211

def containers
  @containers
end

#diskObject (readonly)

Returns the value of attribute disk

Returns:

  • (Object)

    the current value of disk



211
212
213
# File 'lib/bsdkrun/types.rb', line 211

def disk
  @disk
end

#disk_sizeObject (readonly)

Returns the value of attribute disk_size

Returns:

  • (Object)

    the current value of disk_size



211
212
213
# File 'lib/bsdkrun/types.rb', line 211

def disk_size
  @disk_size
end

#imagesObject (readonly)

Returns the value of attribute images

Returns:

  • (Object)

    the current value of images



211
212
213
# File 'lib/bsdkrun/types.rb', line 211

def images
  @images
end

#machine_idObject (readonly)

Returns the value of attribute machine_id

Returns:

  • (Object)

    the current value of machine_id



211
212
213
# File 'lib/bsdkrun/types.rb', line 211

def machine_id
  @machine_id
end

#machine_runningObject (readonly)

Returns the value of attribute machine_running

Returns:

  • (Object)

    the current value of machine_running



211
212
213
# File 'lib/bsdkrun/types.rb', line 211

def machine_running
  @machine_running
end

#mountsObject (readonly)

Returns the value of attribute mounts

Returns:

  • (Object)

    the current value of mounts



211
212
213
# File 'lib/bsdkrun/types.rb', line 211

def mounts
  @mounts
end

#runningObject (readonly)

Returns the value of attribute running

Returns:

  • (Object)

    the current value of running



211
212
213
# File 'lib/bsdkrun/types.rb', line 211

def running
  @running
end

#socketObject (readonly)

Returns the value of attribute socket

Returns:

  • (Object)

    the current value of socket



211
212
213
# File 'lib/bsdkrun/types.rb', line 211

def socket
  @socket
end

#socket_readyObject (readonly)

Returns the value of attribute socket_ready

Returns:

  • (Object)

    the current value of socket_ready



211
212
213
# File 'lib/bsdkrun/types.rb', line 211

def socket_ready
  @socket_ready
end

#versionObject (readonly)

Returns the value of attribute version

Returns:

  • (Object)

    the current value of version



211
212
213
# File 'lib/bsdkrun/types.rb', line 211

def version
  @version
end

Class Method Details

.from_graphql(s) ⇒ DockerStatus

Parameters:

  • s (Hash)

    a GraphQL DockerStatus (camelCase).

Returns:



217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/bsdkrun/types.rb', line 217

def self.from_graphql(s)
  new(
    running: !!s["running"],
    machine_id: s["machineId"],
    machine_running: !!s["machineRunning"],
    socket: s["socket"].to_s,
    socket_ready: !!s["socketReady"],
    api_port: to_i_or_nil(s["apiPort"]),
    version: s["version"],
    containers: to_i_or_nil(s["containers"]),
    images: to_i_or_nil(s["images"]),
    mounts: Array(s["mounts"]),
    disk: s["disk"],
    disk_size: to_i_or_nil(s["diskSize"])
  )
end

.from_row(row) ⇒ DockerStatus

Parameters:

  • row (Hash)

    a bsdkrun docker status --json row (snake_case).

Returns:



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/bsdkrun/types.rb', line 236

def self.from_row(row)
  new(
    running: !!row["running"],
    machine_id: row["machine_id"],
    machine_running: !!row["machine_running"],
    socket: row["socket"].to_s,
    socket_ready: !!row["socket_ready"],
    api_port: to_i_or_nil(row["api_port"]),
    version: row["version"],
    containers: to_i_or_nil(row["containers"]),
    images: to_i_or_nil(row["images"]),
    mounts: Array(row["mounts"]),
    disk: row["disk"],
    disk_size: to_i_or_nil(row["disk_size"])
  )
end