class Diplomat::Status

Methods for interacting with the Consul status API endpoints, leader and peers

Public Instance Methods

leader(options = {}) click to toggle source

Get the raft leader for the datacenter in which the local consul agent is running @param options [Hash] options parameter hash @return [OpenStruct] the address of the leader

# File lib/diplomat/status.rb, line 9
def leader(options = {})
  ret = send_get_request(@conn, ['/v1/status/leader'], options)
  JSON.parse(ret.body)
end
peers(options = {}) click to toggle source

Get an array of Raft peers for the datacenter in which the agent is running @param options [Hash] options parameter hash @return [OpenStruct] an array of peers

# File lib/diplomat/status.rb, line 17
def peers(options = {})
  ret = send_get_request(@conn, ['/v1/status/peers'], options)
  JSON.parse(ret.body)
end