Class: Diplomat::Status
- Inherits:
-
RestClient
- Object
- RestClient
- Diplomat::Status
- Defined in:
- lib/diplomat/status.rb
Overview
Methods for interacting with the Consul status API endpoints, leader and peers
Instance Method Summary collapse
-
#leader(options = {}) ⇒ OpenStruct
Get the raft leader for the datacenter in which the local consul agent is running.
-
#peers(options = {}) ⇒ OpenStruct
Get an array of Raft peers for the datacenter in which the agent is running.
Methods inherited from RestClient
access_method?, #concat_url, #configuration, #initialize, method_missing, respond_to?, respond_to_missing?, #use_named_parameter
Constructor Details
This class inherits a constructor from Diplomat::RestClient
Instance Method Details
#leader(options = {}) ⇒ OpenStruct
Get the raft leader for the datacenter in which the local consul agent is running
11 12 13 14 |
# File 'lib/diplomat/status.rb', line 11 def leader( = {}) ret = send_get_request(@conn, ['/v1/status/leader'], ) JSON.parse(ret.body) end |
#peers(options = {}) ⇒ OpenStruct
Get an array of Raft peers for the datacenter in which the agent is running
19 20 21 22 |
# File 'lib/diplomat/status.rb', line 19 def peers( = {}) ret = send_get_request(@conn, ['/v1/status/peers'], ) JSON.parse(ret.body) end |