Class: Marathon::ContainerVolume

Inherits:
Base
  • Object
show all
Defined in:
lib/marathon/container_volume.rb

Overview

This class represents a Marathon Container Volume information. See mesosphere.github.io/marathon/docs/native-docker.html for full details.

Constant Summary collapse

ACCESSORS =
%w[ containerPath hostPath mode ]
DEFAULTS =
{
    :mode => 'RW'
}

Instance Attribute Summary

Attributes inherited from Base

#info

Instance Method Summary collapse

Methods inherited from Base

#to_json

Methods included from Error

error_class, error_message, from_response

Constructor Details

#initialize(hash) ⇒ ContainerVolume

Create a new container volume object. hash: Hash returned by API.



12
13
14
15
16
17
18
19
# File 'lib/marathon/container_volume.rb', line 12

def initialize(hash)
  super(Marathon::Util.merge_keywordized_hash(DEFAULTS, hash), ACCESSORS)
  Marathon::Util.validate_choice('mode', mode, %w[RW RO])
  raise Marathon::Error::ArgumentError, 'containerPath must not be nil' unless containerPath
  raise Marathon::Error::ArgumentError, 'containerPath must be an absolute path' \
    unless Pathname.new(containerPath).absolute?
  raise Marathon::Error::ArgumentError, 'hostPath must not be nil' unless hostPath
end

Instance Method Details

#to_pretty_sObject



21
22
23
# File 'lib/marathon/container_volume.rb', line 21

def to_pretty_s
  "#{containerPath}:#{hostPath}:#{mode}"
end

#to_sObject



25
26
27
# File 'lib/marathon/container_volume.rb', line 25

def to_s
  "Marathon::ContainerVolume { :containerPath => #{containerPath} :hostPath => #{hostPath} :mode => #{mode} }"
end