class Diplomat::Status

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

Public Instance Methods

leader() click to toggle source

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

# File lib/diplomat/status.rb, line 8
def leader
  url = ['/v1/status/leader']
  ret = @conn.get concat_url url
  JSON.parse(ret.body)
end
peers() click to toggle source

Get an array of Raft peers for the datacenter in which the agent is running @return [OpenStruct] an array of peers

# File lib/diplomat/status.rb, line 16
def peers
  url = ['/v1/status/peers']
  ret = @conn.get concat_url url
  JSON.parse(ret.body)
end