Class: Microsandbox::VolumeInfo
- Inherits:
-
Object
- Object
- Microsandbox::VolumeInfo
- Defined in:
- lib/microsandbox/volume.rb
Overview
A named persistent volume, from Microsandbox::Volume.create / Microsandbox::Volume.get / Microsandbox::Volume.list.
‘path` is populated when returned from Microsandbox::Volume.create; the storage stats (`kind`, `used_bytes`, …) are populated when returned from Microsandbox::Volume.get/Microsandbox::Volume.list.
Instance Attribute Summary collapse
-
#capacity_bytes ⇒ Object
readonly
Returns the value of attribute capacity_bytes.
-
#disk_format ⇒ Object
readonly
Returns the value of attribute disk_format.
-
#disk_fstype ⇒ Object
readonly
Returns the value of attribute disk_fstype.
-
#labels ⇒ Object
readonly
Returns the value of attribute labels.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#quota_mib ⇒ Object
readonly
Returns the value of attribute quota_mib.
-
#used_bytes ⇒ Object
readonly
Returns the value of attribute used_bytes.
Instance Method Summary collapse
- #created_at ⇒ Time?
-
#initialize(data) ⇒ VolumeInfo
constructor
A new instance of VolumeInfo.
- #inspect ⇒ Object
-
#kind ⇒ Symbol?
:directory or :disk.
Constructor Details
#initialize(data) ⇒ VolumeInfo
Returns a new instance of VolumeInfo.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/microsandbox/volume.rb', line 12 def initialize(data) @name = data["name"] @path = data["path"] @kind = data["kind"] @quota_mib = data["quota_mib"] @used_bytes = data["used_bytes"] @capacity_bytes = data["capacity_bytes"] @disk_format = data["disk_format"] @disk_fstype = data["disk_fstype"] @labels = data["labels"] || {} @created_at_ms = data["created_at_ms"] end |
Instance Attribute Details
#capacity_bytes ⇒ Object (readonly)
Returns the value of attribute capacity_bytes.
9 10 11 |
# File 'lib/microsandbox/volume.rb', line 9 def capacity_bytes @capacity_bytes end |
#disk_format ⇒ Object (readonly)
Returns the value of attribute disk_format.
9 10 11 |
# File 'lib/microsandbox/volume.rb', line 9 def disk_format @disk_format end |
#disk_fstype ⇒ Object (readonly)
Returns the value of attribute disk_fstype.
9 10 11 |
# File 'lib/microsandbox/volume.rb', line 9 def disk_fstype @disk_fstype end |
#labels ⇒ Object (readonly)
Returns the value of attribute labels.
9 10 11 |
# File 'lib/microsandbox/volume.rb', line 9 def labels @labels end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/microsandbox/volume.rb', line 9 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
9 10 11 |
# File 'lib/microsandbox/volume.rb', line 9 def path @path end |
#quota_mib ⇒ Object (readonly)
Returns the value of attribute quota_mib.
9 10 11 |
# File 'lib/microsandbox/volume.rb', line 9 def quota_mib @quota_mib end |
#used_bytes ⇒ Object (readonly)
Returns the value of attribute used_bytes.
9 10 11 |
# File 'lib/microsandbox/volume.rb', line 9 def used_bytes @used_bytes end |
Instance Method Details
#created_at ⇒ Time?
31 32 33 |
# File 'lib/microsandbox/volume.rb', line 31 def created_at @created_at_ms && Time.at(@created_at_ms / 1000.0) end |
#inspect ⇒ Object
35 36 37 |
# File 'lib/microsandbox/volume.rb', line 35 def inspect "#<Microsandbox::VolumeInfo name=#{@name.inspect}#{@kind ? " kind=#{@kind}" : ""}>" end |
#kind ⇒ Symbol?
Returns :directory or :disk.
26 27 28 |
# File 'lib/microsandbox/volume.rb', line 26 def kind @kind&.to_sym end |