Class: Nomad::Agent
Instance Attribute Summary
Attributes inherited from Request
Instance Method Summary collapse
-
#force_leave(node, ...) ⇒ Boolean
Force a node to leave the gossip pool.
-
#join(*addresses, **options) ⇒ AgentJoin
Join a new member to the gossip pool.
-
#members(options = {}) ⇒ AgentMembers
Get the list of known agent names.
-
#self(options = {}) ⇒ AgentSelf
Get information about the current agent (self).
-
#servers(options = {}) ⇒ Object
Get the list of servers.
-
#update_servers(*addresses, **options) ⇒ Boolean
Updates the list of servers.
Methods inherited from Request
Constructor Details
This class inherits a constructor from Nomad::Request
Instance Method Details
#force_leave(node, ...) ⇒ Boolean
Force a node to leave the gossip pool.
40 41 42 43 44 45 |
# File 'lib/nomad/api/agent.rb', line 40 def force_leave(*nodes, **) raise "Missing node(s)!" if nodes.empty? qs = nodes.map { |v| "node=#{CGI.escape(v)}" }.join("&")[/.+/] client.post("/v1/agent/force-leave?#{qs}", ) return true end |
#join(*addresses, **options) ⇒ AgentJoin
Join a new member to the gossip pool.
24 25 26 27 28 29 |
# File 'lib/nomad/api/agent.rb', line 24 def join(*addresses, **) raise "Missing address(es)!" if addresses.empty? qs = addresses.map { |v| "address=#{CGI.escape(v)}" }.join("&")[/.+/] json = client.post("/v1/agent/join?#{qs}", ) return AgentJoin.decode(json) end |
#members(options = {}) ⇒ AgentMembers
Get the list of known agent names.
53 54 55 56 |
# File 'lib/nomad/api/agent.rb', line 53 def members( = {}) json = client.get("/v1/agent/members", ) return AgentMembers.decode(json) end |
#self(options = {}) ⇒ AgentSelf
Get information about the current agent (self).
64 65 66 67 |
# File 'lib/nomad/api/agent.rb', line 64 def self( = {}) json = client.get("/v1/agent/self", ) return AgentSelf.decode(json) end |
#servers(options = {}) ⇒ Object
Get the list of servers.
73 74 75 |
# File 'lib/nomad/api/agent.rb', line 73 def servers( = {}) return client.get("/v1/agent/servers", ) end |
#update_servers(*addresses, **options) ⇒ Boolean
Updates the list of servers.
83 84 85 86 87 88 |
# File 'lib/nomad/api/agent.rb', line 83 def update_servers(*addresses, **) raise "Missing address(es)!" if addresses.empty? qs = addresses.map { |v| "address=#{CGI.escape(v)}" }.join("&")[/.+/] client.post("/v1/agent/servers?#{qs}", ) return true end |