Class: Nomad::Operator

Inherits:
Request show all
Defined in:
lib/nomad/api/operator.rb

Defined Under Namespace

Classes: RaftConfiguration, RaftConfigurationItem

Instance Attribute Summary

Attributes inherited from Request

#client

Instance Method Summary collapse

Methods inherited from Request

#initialize, #inspect, #to_s

Constructor Details

This class inherits a constructor from Nomad::Request

Instance Method Details

#raft_configuration(**options) ⇒ Operator::Raft::Configuration

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

Examples:

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

Parameters:

  • [String] (Hash)

    a customizable set of options

  • [Boolean] (Hash)

    a customizable set of options

Returns:

  • (Operator::Raft::Configuration)


25
26
27
28
# 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) ⇒ Operator::Raft::Configuration

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

Examples:

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

Parameters:

  • address (String)

    the address of the peer to remove

  • [String] (Hash)

    a customizable set of options

  • [Boolean] (Hash)

    a customizable set of options

Returns:

  • (Operator::Raft::Configuration)


43
44
45
46
47
48
# 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