NomadClient.Api.Agent (nomad_client v0.12.4)

API calls for all endpoints tagged Agent.

Link to this section Summary

Functions

Forces a member of the gossip pool from the "failed" state into the "left" state.

Performs a basic healthcheck

Queries for the known peers in the gossip pool

Queries for information about the agent we are connected to

Queries an agent in client mode for its list of known servers

Causes the agent to join a cluster by joining the gossip pool at one of the given addresses

Streams logs from a specific Nomad server node

Updates the list of known servers to the given addresses, replacing all previous addresses

Link to this section Functions

Link to this function

force_leave(connection, node, opts \\ [])

Specs

force_leave(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, nil} | {:error, Tesla.Env.t()}

Forces a member of the gossip pool from the "failed" state into the "left" state.

Parameters

  • connection (NomadClient.Connection): Connection to server
  • node (String.t): the name of the node
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

get_health(connection, opts \\ [])

Specs

Performs a basic healthcheck

Parameters

  • connection (NomadClient.Connection): Connection to server
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

get_members(connection, opts \\ [])

Specs

get_members(Tesla.Env.client(), keyword()) ::
  {:ok, NomadClient.Model.ServerMembers.t()} | {:error, Tesla.Env.t()}

Queries for the known peers in the gossip pool

Parameters

  • connection (NomadClient.Connection): Connection to server
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

get_self(connection, opts \\ [])

Specs

get_self(Tesla.Env.client(), keyword()) ::
  {:ok, NomadClient.Model.AgentSelf.t()} | {:error, Tesla.Env.t()}

Queries for information about the agent we are connected to

Parameters

  • connection (NomadClient.Connection): Connection to server
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

get_servers(connection, opts \\ [])

Specs

get_servers(Tesla.Env.client(), keyword()) ::
  {:ok, [String.t()]} | {:error, Tesla.Env.t()}

Queries an agent in client mode for its list of known servers

Parameters

  • connection (NomadClient.Connection): Connection to server
  • opts (KeywordList): [optional] Optional parameters

    Returns

, ...]} on success {:error, Tesla.Env.t} on failure

Link to this function

join(connection, address, opts \\ [])

Specs

Causes the agent to join a cluster by joining the gossip pool at one of the given addresses

Parameters

  • connection (NomadClient.Connection): Connection to server
  • address ([String.t]): server address (ip:port)
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

stream_logs(connection, opts \\ [])

Specs

stream_logs(Tesla.Env.client(), keyword()) ::
  {:ok, NomadClient.Model.StreamFrame.t()} | {:error, Tesla.Env.t()}

Streams logs from a specific Nomad server node

Parameters

  • connection (NomadClient.Connection): Connection to server
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests
    • :log_level (String.t): log level
    • :node_id (String.t): node id
    • :server_id (String.t): server id
    • :json (boolean()): is json format
    • :plain (boolean()): is plain text format

      Returns

on success {:error, Tesla.Env.t} on failure

Link to this function

update_servers(connection, address, opts \\ [])

Specs

update_servers(Tesla.Env.client(), [String.t()], keyword()) ::
  {:ok, [String.t()]} | {:error, Tesla.Env.t()}

Updates the list of known servers to the given addresses, replacing all previous addresses

Parameters

  • connection (NomadClient.Connection): Connection to server
  • address ([String.t]): server address (ip:port)
  • opts (KeywordList): [optional] Optional parameters
    • :namespace (String.t):
    • :region (String.t): Make a request across regions to the given region
    • :index (integer()): index used for blocking requests
    • :wait (String.t): wait time used for blocking requests

      Returns

, ...]} on success {:error, Tesla.Env.t} on failure