NomadClient.Api.Nodes (nomad_client v0.12.4)

API calls for all endpoints tagged Nodes.

Link to this section Summary

Functions

creates a new evaluation for the given node. This can be used to force a run of the scheduling logic

lists all of the allocations for the given node This can be used to determine what allocations have been scheduled on the node, their current status, and the values of dynamically assigned resources, like ports

queries the status of a client node

lists all nodes registered with Nomad

returns matches for a given prefix and context, where a context can be jobs, allocations, evaluations, nodes, or deployments When using Nomad Enterprise, the allowed contexts include quotas and namespaces. Additionally, a prefix can be searched for within every context

toggles the drain mode of the node When draining is enabled, no further allocations will be assigned to this node, and existing allocations will be migrated to new nodes

Link to this section Functions

Link to this function

evaluate_node(connection, node_id, opts \\ [])

Specs

evaluate_node(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, NomadClient.Model.NodeEvalResponse.t()} | {:error, Tesla.Env.t()}

creates a new evaluation for the given node. This can be used to force a run of the scheduling logic

Parameters

  • connection (NomadClient.Connection): Connection to server
  • node_id (String.t): Specifies the ID of the node. This must be the full UUID, not the short 8-character one. This is specified as part of the path
  • 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_allocations_for_node(connection, node_id, opts \\ [])

Specs

get_allocations_for_node(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, [NomadClient.Model.AllocationListStub.t()]} | {:error, Tesla.Env.t()}

lists all of the allocations for the given node This can be used to determine what allocations have been scheduled on the node, their current status, and the values of dynamically assigned resources, like ports

Parameters

  • connection (NomadClient.Connection): Connection to server
  • node_id (String.t): Specifies the ID of the node. This must be the full UUID, not the short 8-character one. This is specified as part of the path
  • 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_node(connection, node_id, opts \\ [])

Specs

get_node(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, NomadClient.Model.Node.t()} | {:error, Tesla.Env.t()}

queries the status of a client node

Parameters

  • connection (NomadClient.Connection): Connection to server
  • node_id (String.t): Specifies the ID of the node. This must be the full UUID, not the short 8-character one. This is specified as part of the path
  • 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_nodes(connection, opts \\ [])

Specs

get_nodes(Tesla.Env.client(), keyword()) ::
  {:ok, [NomadClient.Model.NodeListStub.t()]} | {:error, Tesla.Env.t()}

lists all nodes registered with Nomad

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
    • :prefix (String.t): Specifies a string to filter jobs on based on an index prefix. This is specified as a query string parameter

      Returns

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

Link to this function

search(connection, search_request, opts \\ [])

Specs

returns matches for a given prefix and context, where a context can be jobs, allocations, evaluations, nodes, or deployments When using Nomad Enterprise, the allowed contexts include quotas and namespaces. Additionally, a prefix can be searched for within every context

Parameters

  • connection (NomadClient.Connection): Connection to server
  • search_request (SearchRequest):
  • 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

update_drain_mode_for_node(connection, node_id, node_update_drain_request, opts \\ [])

Specs

toggles the drain mode of the node When draining is enabled, no further allocations will be assigned to this node, and existing allocations will be migrated to new nodes

Parameters

  • connection (NomadClient.Connection): Connection to server
  • node_id (String.t): Specifies the ID of the node. This must be the full UUID, not the short 8-character one. This is specified as part of the path
  • node_update_drain_request (NodeUpdateDrainRequest):
  • 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

update_node_eligibility(connection, node_id, node_update_eligibility_request, opts \\ [])

Specs

toggles the scheduling eligibility of the node

Parameters

  • connection (NomadClient.Connection): Connection to server
  • node_id (String.t): Specifies the ID of the node. This must be the full UUID, not the short 8-character one. This is specified as part of the path
  • node_update_eligibility_request (NodeUpdateEligibilityRequest):
  • 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