Class: Marathon::Container
Overview
This class represents a Marathon Container information. It is included in App’s definition. See mesosphere.github.io/marathon/docs/native-docker.html for full details.
Constant Summary collapse
- SUPPERTED_TYPES =
%w[ DOCKER MESOS]
- ACCESSORS =
%w[ type ]
- DEFAULTS =
{ :type => 'DOCKER', :volumes => [] }
Instance Attribute Summary collapse
-
#docker ⇒ Object
readonly
Returns the value of attribute docker.
-
#volumes ⇒ Object
readonly
Returns the value of attribute volumes.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(hash) ⇒ Container
constructor
Create a new container object.
- #to_s ⇒ Object
Methods inherited from Base
Methods included from Error
error_class, error_message, from_response
Constructor Details
#initialize(hash) ⇒ Container
Create a new container object. hash
: Hash returned by API.
17 18 19 20 21 22 |
# File 'lib/marathon/container.rb', line 17 def initialize(hash) super(Marathon::Util.merge_keywordized_hash(DEFAULTS, hash), ACCESSORS) Marathon::Util.validate_choice('type', type, SUPPERTED_TYPES) @docker = Marathon::ContainerDocker.new(info[:docker]) if info[:docker] @volumes = info[:volumes].map { |e| Marathon::ContainerVolume.new(e) } end |
Instance Attribute Details
#docker ⇒ Object (readonly)
Returns the value of attribute docker.
13 14 15 |
# File 'lib/marathon/container.rb', line 13 def docker @docker end |
#volumes ⇒ Object (readonly)
Returns the value of attribute volumes.
13 14 15 |
# File 'lib/marathon/container.rb', line 13 def volumes @volumes end |
Instance Method Details
#to_s ⇒ Object
24 25 26 27 |
# File 'lib/marathon/container.rb', line 24 def to_s "Marathon::Container { :type => #{type} :docker => #{Marathon::Util.items_to_pretty_s(docker)}"\ + " :volumes => #{Marathon::Util.items_to_pretty_s(volumes)} }" end |