consul.api.coordinates module¶
- class consul.api.coordinates.Coordinate(agent)[source]¶
Bases:
object- datacenters()[source]¶
Returns the WAN network coordinates for all Consul servers, organized by DCs.
- nodes(dc=None, index=None, wait=None, consistency=None)[source]¶
dc is the datacenter that this agent will communicate with. By default the datacenter of the host is used.
index is the current Consul index, suitable for making subsequent calls to wait for changes since this query was last run.
wait the maximum duration to wait (e.g. ’10s’) to retrieve a given index. this parameter is only applied if index is also specified. the wait time by default is 5 minutes.
consistency can be either ‘default’, ‘consistent’ or ‘stale’. if not specified consistency will the consistency level this client was configured with.
- node(node, dc=None, index=None, wait=None, consistency=None)[source]¶
Returns the LAN network coordinates for the node node.
dc is the datacenter that this agent will communicate with. By default the datacenter of the host is used.
index is the current Consul index, suitable for making subsequent calls to wait for changes since this query was last run.
wait the maximum duration to wait (e.g. ’10s’) to retrieve a given index. this parameter is only applied if index is also specified. the wait time by default is 5 minutes.
consistency can be either ‘default’, ‘consistent’ or ‘stale’. if not specified consistency will the consistency level this client was configured with.
- Parameters:
node (str)
- update(node, coord, segment=None, dc=None, token=None)[source]¶
Updates the LAN network coordinates for the node node.
coord is the network coordinate, a dict with the keys ‘Adjustment’, ‘Error’, ‘Height’ and ‘Vec’, as returned by coordinate.node or coordinate.nodes.
segment is the network segment the node belongs to. Enterprise only.
dc is the datacenter that this agent will communicate with. By default the datacenter of the host is used.
token is an optional ACL token to apply to this request. ACL required : node:write
Returns True on success.