module Consul::Client::Agent::Service

Container Module for simpler way to create a service.

Public Class Methods

for_name(name, check = nil) click to toggle source

Public: Creates a service using a specific name

name - Name of the service to create check - The Consul::Model::HealthCheck instance to associate with this Session

Returns: Consul::Model::Service instance

# File lib/consul/client/agent.rb, line 266
def self.for_name(name, check = nil)
  raise ArgumentError.new "Illegal name: \"#{name}\" for service." if name.nil?
  unless check.nil? or check.is_a?(Consul::Model::HealthCheck)
    raise TypeError.new "Illegal Check type: #{check}.  Expecting Consul::Model::HealthCheck"
  end
  if check.nil?
    Consul::Model::Service.new(name: name)
  else # There is a health check to register
    Consul::Model::Service.new(name: name, check: check)
  end
end
http_health_check(http, interval) click to toggle source

Returns: Consul::Model::HealthCheck instance that represents a http health check.

# File lib/consul/client/agent.rb, line 284
def self.http_health_check(http, interval)
  Consul::Model::HealthCheck.new(http: http, interval: interval)
end
script_health_check(script, interval) click to toggle source

Returns: Consul::Model::HealthCheck instance that represents a script

# File lib/consul/client/agent.rb, line 279
def self.script_health_check(script, interval)
  Consul::Model::HealthCheck.new(script: script, interval: interval)
end
ttl_health_check(ttl) click to toggle source
# File lib/consul/client/agent.rb, line 288
def self.ttl_health_check(ttl)
  Consul::Model::HealthCheck.new(ttl: ttl)
end