Class: Marathon::HealthCheck
Overview
This class represents a Marathon HealthCheck. See mesosphere.github.io/marathon/docs/health-checks.html for full details.
Constant Summary collapse
- DEFAULTS =
{ :gracePeriodSeconds => 300, :intervalSeconds => 60, :maxConsecutiveFailures => 3, :path => '/', :portIndex => 0, :protocol => 'HTTP', :timeoutSeconds => 20 }
- ACCESSORS =
%w[ command gracePeriodSeconds intervalSeconds maxConsecutiveFailures path portIndex protocol timeoutSeconds ignoreHttp1xx ]
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(hash) ⇒ HealthCheck
constructor
Create a new health check object.
- #to_s ⇒ Object
Methods inherited from Base
Methods included from Error
error_class, error_message, from_response
Constructor Details
#initialize(hash) ⇒ HealthCheck
Create a new health check object. hash
: Hash returned by API.
20 21 22 23 |
# File 'lib/marathon/health_check.rb', line 20 def initialize(hash) super(Marathon::Util.merge_keywordized_hash(DEFAULTS, hash), ACCESSORS) Marathon::Util.validate_choice(:protocol, protocol, %w[HTTP TCP COMMAND HTTPS MESOS_HTTP MESOS_HTTPS MESOS_TCP]) end |
Instance Method Details
#to_s ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/marathon/health_check.rb', line 25 def to_s if protocol == 'COMMAND' "Marathon::HealthCheck { :protocol => #{protocol} :command => #{command} }" elsif %w[HTTP HTTPS MESOS_HTTP MESOS_HTTPS].include? protocol "Marathon::HealthCheck { :protocol => #{protocol} :portIndex => #{portIndex} :path => #{path}" + (%w[HTTP HTTPS].include? protocol and !ignoreHttp1xx.nil? ? " :ignoreHttp1xx => #{ignoreHttp1xx}" : '') + " }" else "Marathon::HealthCheck { :protocol => #{protocol} :portIndex => #{portIndex} }" end end |