class Nomad::Operator

Public Instance Methods

raft_configuration(**options) click to toggle source

Queries the status of a nodes registered with Nomad in the Raft subsystem.

@example

Nomad.operator.raft_configuration #=> #<Operator::Raft::Configuration>

@option [String] :region

the region to query (by default, the region of the agent is queried)

@option [Boolean] :stale

allow reading stale queries if there is no leader

@return [Operator::Raft::Configuration]

# File lib/nomad/api/operator.rb, line 25
def raft_configuration(**options)
  json = client.get("/v1/operator/raft/configuration", options)
  return RaftConfiguration.decode(json)
end
remove_raft_peer(*addresses, **options) click to toggle source

Queries the status of a nodes registered with Nomad in the Raft subsystem.

@example

Nomad.operator.remove_raft_peer("1.2.3.4") #=> true

@param [String] address the address of the peer to remove

@option [String] :region

the region to query (by default, the region of the agent is queried)

@option [Boolean] :stale

allow reading stale queries if there is no leader

@return [Operator::Raft::Configuration]

# File lib/nomad/api/operator.rb, line 43
def remove_raft_peer(*addresses, **options)
  raise "Missing address(es)!" if addresses.empty?
  qs = addresses.map { |v| "address=#{CGI.escape(v)}" }.join("&")[/.+/]
  client.delete("/v1/operator/raft/peer?#{qs}", options)
  return true
end