class Marathon::ContainerDockerPortMapping
This class represents a Marathon
Container docker information. See mesosphere.github.io/marathon/docs/native-docker.html for full details.
Constants
- ACCESSORS
- DEFAULTS
Public Class Methods
new(hash)
click to toggle source
Create a new container docker port mappint object. hash
: Hash returned by API.
Calls superclass method
Marathon::Base::new
# File lib/marathon/container_docker_port_mapping.rb, line 13 def initialize(hash) super(Marathon::Util.merge_keywordized_hash(DEFAULTS, hash), ACCESSORS) Marathon::Util.validate_choice('protocol', protocol, %w[tcp udp]) raise Marathon::Error::ArgumentError, 'containerPort must not be nil' unless containerPort raise Marathon::Error::ArgumentError, 'containerPort must be a non negative number' \ unless containerPort.is_a?(Integer) and containerPort >= 0 raise Marathon::Error::ArgumentError, 'hostPort must be a non negative number' \ unless hostPort.is_a?(Integer) and hostPort >= 0 end
Public Instance Methods
to_pretty_s()
click to toggle source
# File lib/marathon/container_docker_port_mapping.rb, line 23 def to_pretty_s "#{protocol}/#{containerPort}:#{hostPort}" end
to_s()
click to toggle source
# File lib/marathon/container_docker_port_mapping.rb, line 27 def to_s "Marathon::ContainerDockerPortMapping { :protocol => #{protocol} " \ + ":containerPort => #{containerPort} :hostPort => #{hostPort} }" end