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
# 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
end

Instance Method Details

#to_pretty_sObject



18
19
20
# File 'lib/marathon/container_volume.rb', line 18

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

#to_sObject



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

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