module Consul::Client::Agent::HealthCheck

Public Class Methods

http(name, http, interval, id = name, notes = nil) click to toggle source

Public: HTTP Check

name - The name of the check, Cannot be nil http - The HTTP endpoint to hit with periodic GET. interval - The time interval to conduct the check. IE: '10s' id - ID to associate with this check if 'name' is not desired. notes - Message to place as notes for this check

Returns: Consul::Model::HealthCheck instance

# File lib/consul/client/agent.rb, line 239
def self.http(name, http, interval, id = name, notes = nil)
  validate_arg name
  validate_arg http
  validate_arg interval
  c = Consul::Model::HealthCheck.new(name: name, http: http, interval: interval)
  c.id = id unless id.nil?
  c.notes = notes unless notes.nil?
  c
end
script(name, script, interval, id = name, notes = nil) click to toggle source

Public: Script Check

name - The name of the check, Cannot be nil script - The script to run locally interval - The time interval to conduct the check. IE: '10s' id - ID to associate with this check if 'name' is not desired. notes - Message to place as notes for this check.

Returns: Consul::Model::HealthCheck instance

# File lib/consul/client/agent.rb, line 220
def self.script(name, script, interval, id = name, notes = nil)
  validate_arg name
  validate_arg script
  validate_arg interval
  c = Consul::Model::HealthCheck.new(name: name, script: script, interval: interval)
  c.id = id unless id.nil?
  c.notes = notes unless notes.nil?
  c
end
ttl(name, ttl, id = name, notes = nil) click to toggle source

Public: TTL Check

name - The name of the check, Cannot be nil ttl - Time to live time window. IE ā€œ15sā€, Cannot be nil id - ID to associate with this check if 'name' is not desired. notes - Message to place as notes for this check

Returns: Consul::Model::HealthCheck instance

# File lib/consul/client/agent.rb, line 202
def self.ttl(name, ttl, id = name, notes = nil)
  validate_arg name
  validate_arg ttl
  c = Consul::Model::HealthCheck.new(name: name, ttl: ttl)
  c.id = id unless id.nil?
  c.notes = notes unless notes.nil?
  c
end

Private Class Methods

validate_arg(arg) click to toggle source
# File lib/consul/client/agent.rb, line 251
def self.validate_arg(arg)
  raise ArgumentError.new "Illegal Argument: #{arg}" if arg.nil? or arg.empty?
end