Class: Marathon::ContainerDocker
- Defined in:
- lib/marathon/container_docker.rb
Overview
This class represents a Marathon Container docker information. See mesosphere.github.io/marathon/docs/native-docker.html for full details.
Constant Summary collapse
- ACCESSORS =
%w[ image network privileged parameters ]
- DEFAULTS =
{ :network => 'BRIDGE', :portMappings => [] }
Instance Attribute Summary collapse
-
#portMappings ⇒ Object
readonly
Returns the value of attribute portMappings.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(hash) ⇒ ContainerDocker
constructor
Create a new container docker object.
- #to_pretty_s ⇒ Object
- #to_s ⇒ Object
Methods inherited from Base
Methods included from Error
error_class, error_message, from_response
Constructor Details
#initialize(hash) ⇒ ContainerDocker
Create a new container docker object. hash
: Hash returned by API.
15 16 17 18 19 20 21 |
# File 'lib/marathon/container_docker.rb', line 15 def initialize(hash) super(Marathon::Util.merge_keywordized_hash(DEFAULTS, hash), ACCESSORS) Marathon::Util.validate_choice('network', network, %w[BRIDGE HOST]) Marathon::Util.validate_choice('privileged', privileged, ['true', 'false', true, false]) raise Marathon::Error::ArgumentError, 'image must not be nil' unless image @portMappings = (info[:portMappings] || []).map { |e| Marathon::ContainerDockerPortMapping.new(e) } end |
Instance Attribute Details
#portMappings ⇒ Object (readonly)
Returns the value of attribute portMappings.
11 12 13 |
# File 'lib/marathon/container_docker.rb', line 11 def portMappings @portMappings end |
Instance Method Details
#to_pretty_s ⇒ Object
23 24 25 |
# File 'lib/marathon/container_docker.rb', line 23 def to_pretty_s "#{image}" end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/marathon/container_docker.rb', line 27 def to_s "Marathon::ContainerDocker { :image => #{image} }" end |