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 ⇒ OpenStruct
Get the raft leader for the datacenter in which the local consul agent is running.
-
#peers ⇒ OpenStruct
Get an array of Raft peers for the datacenter in which the agent is running.
Methods inherited from RestClient
access_method?, #concat_url, #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 ⇒ OpenStruct
Get the raft leader for the datacenter in which the local consul agent is running
8 9 10 11 12 |
# 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 ⇒ OpenStruct
Get an array of Raft peers for the datacenter in which the agent is running
16 17 18 19 20 |
# File 'lib/diplomat/status.rb', line 16 def peers url = ['/v1/status/peers'] ret = @conn.get concat_url url JSON.parse(ret.body) end |