class Marathon::HealthCheck

This class represents a Marathon HealthCheck. See mesosphere.github.io/marathon/docs/health-checks.html for full details.

Constants

ACCESSORS
DEFAULTS

Public Class Methods

new(hash) click to toggle source

Create a new health check object. hash: Hash returned by API.

Calls superclass method Marathon::Base::new
# 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

Public Instance Methods

to_s() click to toggle source
# 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