Class: Diplomat::RaftOperator
- Inherits:
-
RestClient
- Object
- RestClient
- Diplomat::RaftOperator
- Defined in:
- lib/diplomat/raft.rb
Overview
Methods for interacting with the Consul operator raft API endpoint
Instance Method Summary collapse
-
#get_configuration(options = {}) ⇒ OpenStruct
Get raft configuration.
-
#transfer_leader(options = {}) ⇒ OpenStruct
Transfer raft leadership.
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
#get_configuration(options = {}) ⇒ OpenStruct
Get raft configuration
11 12 13 14 15 16 17 |
# File 'lib/diplomat/raft.rb', line 11 def get_configuration( = {}) custom_params = [] custom_params << use_named_parameter('dc', [:dc]) if [:dc] ret = send_get_request(@conn, ['/v1/operator/raft/configuration'], , custom_params) JSON.parse(ret.body) end |
#transfer_leader(options = {}) ⇒ OpenStruct
Transfer raft leadership
23 24 25 26 27 |
# File 'lib/diplomat/raft.rb', line 23 def transfer_leader( = {}) custom_params = [:id] ? use_named_parameter('id', [:id]) : nil @raw = send_post_request(@conn, ['/v1/operator/raft/transfer-leader'], , nil, custom_params) JSON.parse(@raw.body) end |