ConsulApi

consul4s.v1.api.`package`.ConsulApi
abstract class ConsulApi[F[_]](val url: String, val sttpBackend: SttpBackend[F, Any])(implicit val jsonDecoder: JsonDecoder, val jsonEncoder: JsonEncoder) extends KVStore[F], Status[F], Health[F], Catalog[F], Agent[F], Event[F], Session[F], Coordinate[F], PreparedQuery[F], Transaction[F]

Attributes

Graph
Supertypes
trait Transaction[F]
trait PreparedQuery[F]
trait Coordinate[F]
trait Session[F]
trait Event[F]
trait Agent[F]
trait Catalog[F]
trait Health[F]
trait Status[F]
trait KVStore[F]
class Object
trait Matchable
class Any
Show all
Known subtypes
class ConsulClient[F]

Members list

Type members

Types

type Result[A] = Response[Either[ConsulResponseError, A]]

Value members

Concrete methods

final protected def addCacheMode[A](request: RequestT[Identity, Either[ConsulResponseError, A], Any], cacheMode: CacheMode): RequestT[Identity, Either[ConsulResponseError, A], Any]
final protected def addConsistencyMode(uri: Uri, consistencyMode: ConsistencyMode): Uri
final protected def asResultUnit: ResponseAs[Either[ConsulResponseError, Unit], Any]
final protected def saveSendRequest[A](request: RequestT[Identity, Either[ConsulResponseError, A], Any], bodyF: => String, token: Option[String]): F[Result[A]]
final protected def sendRequest[A](request: RequestT[Identity, Either[ConsulResponseError, A], Any], token: Option[String]): F[Result[A]]

Inherited methods

def createOrUpdate(key: String, value: String, dc: Option[String], flags: Option[Int], cas: Option[Int], acquire: Option[String], release: Option[String], token: Option[String]): F[Result[Boolean]]

PUT /kv/:key This endpoint updates the value of the specified key. If no key exists at the given path, the key will be created.

PUT /kv/:key This endpoint updates the value of the specified key. If no key exists at the given path, the key will be created.

Value parameters

acquire
  • Supply a session ID to use in a lock acquisition operation. This is useful as it allows leader election to be built on top of Consul. If the lock is not held and the session is valid, this increments the LockIndex and sets the Session value of the key in addition to updating the key contents. A key does not need to exist to be acquired. If the lock is already held by the given session, then the LockIndex is not incremented but the key contents are updated. This lets the current lock holder update the key contents without having to give up the lock and reacquire it. Note that an update that does not include the acquire parameter will proceed normally even if another session has locked the key.
cas
  • Specifies to use a Check-And-Set operation. This is very useful as a building block for more complex synchronization primitives. If the index is 0, Consul will only put the key if it does not already exist. If the index is non-zero, the key is only set if the index matches the ModifyIndex of that key.
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
flags
  • Specifies an unsigned value between 0 and pow(2, 64)-1. Clients can choose to use this however makes sense for their application. This is specified as part of the URL as a query parameter.
key
  • Specifies the path of the key to read.
release
  • Supply a session ID to use in a release operation. This is useful when paired with ?acquire= as it allows clients to yield a lock. This will leave the LockIndex unmodified but will clear the associated Session of the key. The key must be held by this session to be unlocked.
token
  • consul token
value
  • The payload is arbitrary, and is loaded directly into Consul as supplied.

Attributes

Returns
  • true if key was created
Inherited from:
KVStore
def createSession(newSession: NewSession, dc: Option[String], token: Option[String]): F[Result[SessionId]]

PUT /session/create This endpoint initializes a new session. Sessions must be associated with a node and may be associated with any number of checks.

PUT /session/create This endpoint initializes a new session. Sessions must be associated with a node and may be associated with any number of checks.

Value parameters

dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
newSession
  • session definition
token
  • consul token

Attributes

Returns
  • ID of the created session
Inherited from:
Session
def createTransaction(txTasks: List[TxTask], dc: Option[String], consistencyMode: ConsistencyMode, token: Option[String]): F[Result[TxResults]]

PUT /txn This endpoint permits submitting a list of operations to apply to Consul inside of a transaction. If any operation fails, the transaction is rolled back and none of the changes are applied.

PUT /txn This endpoint permits submitting a list of operations to apply to Consul inside of a transaction. If any operation fails, the transaction is rolled back and none of the changes are applied.

Value parameters

consistencyMode
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter.
token
  • consul token
txTasks
  • operation list. Up to 64 operations may be present in a single transaction.

Attributes

Returns
  • transaction results. If transaction was roll-backed then errors field will not be empty/
Inherited from:
Transaction
def deleteByKey(key: String, cas: Option[Int], token: Option[String]): F[Result[Boolean]]

DELETE /kv/:key

DELETE /kv/:key

Value parameters

cas
  • Specifies to use a Check-And-Set operation. This is very useful as a building block for more complex synchronization primitives. If the index is 0, Consul will only put the key if it does not already exist. If the index is non-zero, the key is only set if the index matches the ModifyIndex of that key.
key
  • Specifies the path of the key to read.
token
  • consul token

Attributes

Returns
  • true if key was deleted
Inherited from:
KVStore
def deleteByKeyPath(path: String, cas: Option[Int], token: Option[String]): F[Result[Boolean]]

DELETE /kv/:key?recurse recurse - Specifies to delete all keys which have the specified prefix.

DELETE /kv/:key?recurse recurse - Specifies to delete all keys which have the specified prefix.

Value parameters

cas
  • Specifies to use a Check-And-Set operation. This is very useful as a building block for more complex synchronization primitives. If the index is 0, Consul will only put the key if it does not already exist. If the index is non-zero, the key is only set if the index matches the ModifyIndex of that key.
path
  • Specifies the path of the key to delete.
token
  • consul token

Attributes

Returns
  • true if key was deleted
Inherited from:
KVStore
def deleteSession(sessionId: SessionId, dc: Option[String], token: Option[String]): F[Result[Boolean]]

PUT /session/destroy/:uuid This endpoint destroys the session with the given name. If the session UUID is malformed, an error is returned. If the session UUID does not exist or already expired, a 200 is still returned (the operation is idempotent).

PUT /session/destroy/:uuid This endpoint destroys the session with the given name. If the session UUID is malformed, an error is returned. If the session UUID does not exist or already expired, a 200 is still returned (the operation is idempotent).

Value parameters

dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
sessionId
  • session ID
token
  • consul token

Attributes

Returns
  • true if session was deleted otherwise false
Inherited from:
Session
def deregisterAgentCheck(checkId: String, token: Option[String]): F[Result[Unit]]

PUT /agent/check/deregister/:check_id This endpoint remove a check from the local agent.

PUT /agent/check/deregister/:check_id This endpoint remove a check from the local agent.

Value parameters

checkId
  • check id
token
  • consul token

Attributes

Inherited from:
Agent
def deregisterAgentService(serviceId: String, token: Option[String]): F[Result[Unit]]

PUT /agent/service/deregister/:service_id This endpoint removes a service from the local agent. If the service does not exist, no action is taken.

PUT /agent/service/deregister/:service_id This endpoint removes a service from the local agent. If the service does not exist, no action is taken.

Value parameters

serviceId
  • service id
token
  • consul token

Attributes

Inherited from:
Agent
def deregisterEntity(value: NodeDeregistration, token: Option[String]): F[Result[Unit]]

PUT /catalog/deregister This endpoint is a low-level mechanism for directly removing entries from the Catalog. I

PUT /catalog/deregister This endpoint is a low-level mechanism for directly removing entries from the Catalog. I

Value parameters

token
  • consul token
value
  • entity filter

Attributes

Returns
  • unit
Inherited from:
Catalog
def executeQuery(queryUUID: String, dc: Option[String], near: Option[String], limit: Option[Int], connect: Boolean, token: Option[String], cacheMode: CacheMode): F[Result[Option[QueryResult]]]

GET /query/:uuid/execute This endpoint executes an existing prepared query.

GET /query/:uuid/execute This endpoint executes an existing prepared query.

Value parameters

cacheMode
connect
  • If true, limit results to nodes that are Connect-capable only. This can also be specified directly on the template itself to force all executions of a query to be Connect-only. See the template documentation for more information.
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
limit
  • Limit the size of the list to the given number of nodes. This is applied after any sorting or shuffling.
near
  • Specifies to sort the resulting list in ascending order based on the estimated round trip time from that node. Passing ?near=_agent will use the agent's node for the sort. Passing ?near=_ip will use the source IP of the request or the value of the X-Forwarded-For header to lookup the node to use for the sort. If this is not present, the default behavior will shuffle the nodes randomly each time the query is executed.
queryUUID
  • Specifies the UUID of the query to execute. This is required and is specified as part of the URL path. This can also be the name of an existing prepared query, or a name that matches a prefix name for a prepared query template.
token
  • consul token

Attributes

Returns
  • query result if query exists otherwise None.
Inherited from:
PreparedQuery
def fireEvent(name: String, payload: String, dc: Option[String], node: Option[String], service: Option[String], tag: Option[String], token: Option[String]): F[Result[UserEvent]]

PUT /event/fire/:name This endpoint triggers a new user event.

PUT /event/fire/:name This endpoint triggers a new user event.

Value parameters

dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
name
  • Specifies the name of the event to fire. This is specified as part of the URL. This name must not start with an underscore, since those are reserved for Consul internally.
node
  • Specifies a regular expression to filter by node name. This is specified as part of the URL as a query parameter.
service
  • Specifies a regular expression to filter by service name. This is specified as part of the URL as a query parameter.
tag
  • Specifies a regular expression to filter by tag. This is specified as part of the URL as a query parameter.
token
  • consul token

Attributes

Returns
  • event info
Inherited from:
Event
def getAgentChecks(filter: Option[String], token: Option[String]): F[Result[Map[String, HealthCheck]]]

GET /agent/checks

GET /agent/checks

Value parameters

filter
  • Specifies the expression used to filter the queries results prior to returning the data.
token
  • consul token

Attributes

Returns
  • This endpoint returns all checks that are registered with the local agent.
Inherited from:
Agent
def getAgentLocalServiceHealthById(serviceId: String, token: Option[String]): F[Result[Option[AggregatedServiceStatus]]]

GET /agent/health/service/id/:service_id

GET /agent/health/service/id/:service_id

Value parameters

serviceId
  • service id
token
  • consul token

Attributes

Returns
  • Retrieve an aggregated state of service(s) on the local agent by ID.
Inherited from:
Agent
def getAgentLocalServiceHealthByName(serviceName: String, token: Option[String]): F[Result[Option[List[AggregatedServiceStatus]]]]

GET /agent/health/service/name/:service_name

GET /agent/health/service/name/:service_name

Value parameters

serviceName
  • service name
token
  • consul token

Attributes

Returns
  • Retrieve an aggregated state of service(s) on the local agent by name.
Inherited from:
Agent
def getAgentMembers(wan: Option[Boolean], token: Option[String]): F[Result[List[MemberInfo]]]

GET /agent/members

GET /agent/members

Value parameters

token
  • consul token
wan
  • Specifies to list WAN members instead of the LAN members (which is the default). This is only eligible for agents running in server mode. This is specified as part of the URL as a query parameter.

Attributes

Returns
  • This endpoint returns the members the agent sees in the cluster gossip pool.
Inherited from:
Agent
def getAgentService(serviceId: String, token: Option[String]): F[Result[Option[Service]]]

GET /agent/service/:service_id

GET /agent/service/:service_id

Value parameters

serviceId
  • service id
token
  • consul token

Attributes

Returns
  • This endpoint returns the full service definition for a single service instance registered on the local agent.
Inherited from:
Agent
def getAgentServices(filter: Option[String], token: Option[String]): F[Result[Map[String, Service]]]

GET /agent/services

GET /agent/services

Value parameters

filter
  • Specifies the expression used to filter the queries results prior to returning the data.
token
  • consul token

Attributes

Returns
  • This endpoint returns all the services that are registered with the local agent.
Inherited from:
Agent
def getAllServiceInstances(service: String, dc: Option[String], near: Option[String], tag: Option[String], nodeMeta: Option[String], passing: Boolean, filter: Option[String], consistencyMode: ConsistencyMode, token: Option[String], cacheMode: CacheMode): F[Result[List[ServiceEntry]]]

GET /health/service/:service

GET /health/service/:service

Value parameters

cacheMode
consistencyMode
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
filter
  • Specifies the expression used to filter the queries results prior to returning the data.
near
  • Specifies to sort the resulting list in ascending order based on the estimated round trip time from that node. Passing ?near=_agent will use the agent's node for the sort. Passing ?near=_ip will use the source IP of the request or the value of the X-Forwarded-For header to lookup the node to use for the sort. If this is not present, the default behavior will shuffle the nodes randomly each time the query is executed.
nodeMeta
  • Specifies a desired node metadata key/value pair of the form key:value. This parameter can be specified multiple times, and will filter the results to nodes with the specified key/value pairs. This is specified as part of the URL as a query parameter.
passing
  • Specifies that the server should return only nodes with all checks in the passing state. This can be used to avoid additional filtering on the client side.
service
  • Specifies the service to list services for. This is provided as part of the URL.
tag
  • Specifies the tag to filter the list. This is specified as part of the URL as a query parameter. Can be used multiple times for additional filtering, returning only the results that include all of the tag values provided.
token
  • consul token

Attributes

Inherited from:
Health
def getChecksByState(state: CheckStatus, dc: Option[String], near: Option[String], nodeMeta: Option[String], filter: Option[String], consistencyMode: ConsistencyMode, token: Option[String]): F[Result[List[HealthCheck]]]

GET /health/state/:state This endpoint returns the checks in the state provided on the path.

GET /health/state/:state This endpoint returns the checks in the state provided on the path.

Value parameters

consistencyMode
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
filter
  • Specifies the expression used to filter the queries results prior to returning the data.
near
  • Specifies to sort the resulting list in ascending order based on the estimated round trip time from that node. Passing ?near=_agent will use the agent's node for the sort. Passing ?near=_ip will use the source IP of the request or the value of the X-Forwarded-For header to lookup the node to use for the sort. If this is not present, the default behavior will shuffle the nodes randomly each time the query is executed.
nodeMeta
  • Specifies a desired node metadata key/value pair of the form key:value. This parameter can be specified multiple times, and will filter the results to nodes with the specified key/value pairs. This is specified as part of the URL as a query parameter.
state
  • Specifies the state to query. Supported states are any, passing, warning, or critical. The any state is a wildcard that can be used to return all checks.
token
  • consul token

Attributes

Inherited from:
Health
def getConnectCapableDatacenterServices(service: String, dc: Option[String], tag: Option[String], near: Option[String], nodeMeta: Option[String], filter: Option[String], consistencyMode: ConsistencyMode, token: Option[String]): F[Result[List[CatalogService]]]

GET /catalog/connect/ + service

GET /catalog/connect/ + service

Value parameters

consistencyMode
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
filter
  • Specifies the expression used to filter the queries results prior to returning the data.
near
  • Specifies to sort the resulting list in ascending order based on the estimated round trip time from that node. Passing ?near=_agent will use the agent's node for the sort. Passing ?near=_ip will use the source IP of the request or the value of the X-Forwarded-For header to lookup the node to use for the sort. If this is not present, the default behavior will shuffle the nodes randomly each time the query is executed.
nodeMeta
  • Specifies a desired node metadata key/value pair of the form key:value. This parameter can be specified multiple times, and will filter the results to nodes with the specified key/value pairs. This is specified as part of the URL as a query parameter.
service
  • Specifies the name of the service for which to list nodes. This is specified as part of the URL.
tag
  • Specifies the tag to filter on. This is specified as part of the URL as a query parameter. Can be used multiple times for additional filtering, returning only the results that include all of the tag values provided.
token
  • consul token

Attributes

Returns
  • This endpoint returns the nodes providing a Connect-capable service in a given datacenter.
Inherited from:
Catalog
def getDatacenterCoordinates(token: Option[String]): F[Result[List[DatacenterCoordinate]]]

GET /coordinate/datacenters

GET /coordinate/datacenters

Value parameters

token
  • consul token

Attributes

Returns
  • This endpoint returns the WAN network coordinates for all Consul servers, organized by datacenters.
Inherited from:
Coordinate
def getDatacenterNodes(dc: Option[String], near: Option[String], nodeMeta: Option[String], filter: Option[String], consistencyMode: ConsistencyMode, token: Option[String]): F[Result[List[Node]]]

GET /catalog/nodes

GET /catalog/nodes

Value parameters

consistencyMode
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
filter
  • Specifies the expression used to filter the queries results prior to returning the data.
near
  • Specifies to sort the resulting list in ascending order based on the estimated round trip time from that node. Passing ?near=_agent will use the agent's node for the sort. Passing ?near=_ip will use the source IP of the request or the value of the X-Forwarded-For header to lookup the node to use for the sort. If this is not present, the default behavior will shuffle the nodes randomly each time the query is executed.
nodeMeta
  • Specifies a desired node metadata key/value pair of the form key:value. This parameter can be specified multiple times, and will filter the results to nodes with the specified key/value pairs. This is specified as part of the URL as a query parameter.
token
  • consul token

Attributes

Returns
  • This endpoint returns the nodes registered in a given datacenter.
Inherited from:
Catalog
def getDatacenterServiceNames(dc: Option[String], nodeMeta: Option[String], consistencyMode: ConsistencyMode, token: Option[String]): F[Result[Map[String, List[String]]]]

GET /catalog/services

GET /catalog/services

Value parameters

consistencyMode
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
nodeMeta
  • Specifies a desired node metadata key/value pair of the form key:value. This parameter can be specified multiple times, and will filter the results to nodes with the specified key/value pairs. This is specified as part of the URL as a query parameter.
token
  • consul token

Attributes

Returns
  • This endpoint returns the services registered in a given datacenter.
Inherited from:
Catalog
def getDatacenterServices(service: String, dc: Option[String], tag: Option[String], near: Option[String], nodeMeta: Option[String], filter: Option[String], consistencyMode: ConsistencyMode, token: Option[String], cacheMode: CacheMode): F[Result[List[CatalogService]]]

GET /catalog/service/ + service

GET /catalog/service/ + service

Value parameters

cacheMode
consistencyMode
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
filter
  • Specifies the expression used to filter the queries results prior to returning the data.
near
  • Specifies to sort the resulting list in ascending order based on the estimated round trip time from that node. Passing ?near=_agent will use the agent's node for the sort. Passing ?near=_ip will use the source IP of the request or the value of the X-Forwarded-For header to lookup the node to use for the sort. If this is not present, the default behavior will shuffle the nodes randomly each time the query is executed.
nodeMeta
  • Specifies a desired node metadata key/value pair of the form key:value. This parameter can be specified multiple times, and will filter the results to nodes with the specified key/value pairs. This is specified as part of the URL as a query parameter.
service
  • Specifies the name of the service for which to list nodes. This is specified as part of the URL.
tag
  • Specifies the tag to filter on. This is specified as part of the URL as a query parameter. Can be used multiple times for additional filtering, returning only the results that include all of the tag values provided.
token
  • consul token

Attributes

Returns
  • This endpoint returns the nodes providing a service in a given datacenter.
Inherited from:
Catalog
def getDatacenters(token: Option[String]): F[Result[List[String]]]

GET /catalog/datacenters

GET /catalog/datacenters

Value parameters

token
  • consul token

Attributes

Returns
  • This endpoint returns the list of all known datacenters.
Inherited from:
Catalog
def getEvents(name: Option[String], node: Option[String], service: Option[String], tag: Option[String], token: Option[String]): F[Result[List[UserEvent]]]

GET /event/list This endpoint returns the most recent events (up to 256) known by the agent.

GET /event/list This endpoint returns the most recent events (up to 256) known by the agent.

Value parameters

name
  • filter events by name
node
  • Specifies a regular expression to filter by node name. This is specified as part of the URL as a query parameter.
service
  • Specifies a regular expression to filter by service name. This is specified as part of the URL as a query parameter.
tag
  • Specifies a regular expression to filter by tag. This is specified as part of the URL as a query parameter.
token
  • consul token

Attributes

Returns
  • list of events
Inherited from:
Event
def getHealthyServiceInstances(service: String, dc: Option[String], near: Option[String], tag: Option[String], nodeMeta: Option[String], filter: Option[String], consistencyMode: ConsistencyMode, token: Option[String], cacheMode: CacheMode): F[Result[List[ServiceEntry]]]

Get healthy service instances. For additional info see Health.getAllServiceInstances

Get healthy service instances. For additional info see Health.getAllServiceInstances

Attributes

Inherited from:
Health
def getKeyListByPath(path: String, dc: Option[String], separator: Option[String], consistencyMode: ConsistencyMode, token: Option[String]): F[Result[Option[List[String]]]]

GET /kv/:key?keys

GET /kv/:key?keys

Value parameters

consistencyMode
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
path
  • Specifies the path of the key to read.
separator
  • Specifies the string to use as a separator for recursive key lookups. This option is only used when paired with the keys parameter to limit the prefix of keys returned, only up to the given separator. This is specified as part of the URL as a query parameter.
token
  • consul token

Attributes

Returns
  • list of keys
Inherited from:
KVStore
def getListOfActiveNodeSessions(node: String, dc: Option[String], consistencyMode: ConsistencyMode, token: Option[String]): F[Result[List[SessionInfo]]]

GET /session/node/:node This endpoint returns the active sessions for a given node.

GET /session/node/:node This endpoint returns the active sessions for a given node.

Value parameters

consistencyMode
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
node
  • Specifies the name or ID of the node to query. This is required and is specified as part of the URL path.
token
  • consul token

Attributes

Returns
  • list of active sessions for specified node
Inherited from:
Session
def getListOfActiveSessions(dc: Option[String], consistencyMode: ConsistencyMode, token: Option[String]): F[Result[List[SessionInfo]]]

GET /session/list This endpoint returns the list of active sessions.

GET /session/list This endpoint returns the list of active sessions.

Value parameters

consistencyMode
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
token
  • consul token

Attributes

Returns
  • list of active sessions
Inherited from:
Session
def getListOfNodeServices(node: String, dc: Option[String], filter: Option[String], consistencyMode: ConsistencyMode, token: Option[String]): F[Result[Option[NodeServiceList]]]

GET /catalog/node-services/:node

GET /catalog/node-services/:node

Value parameters

consistencyMode
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
filter
  • Specifies the expression used to filter the queries results prior to returning the data.
node
  • Specifies the name or ID of the node to query. This is specified as part of the URL
token
  • consul token

Attributes

Returns
  • This endpoint returns the node's registered services.
Inherited from:
Catalog
def getMapOfNodeServices(node: String, dc: Option[String], filter: Option[String], consistencyMode: ConsistencyMode, token: Option[String]): F[Result[Option[NodeServiceMap]]]

GET /catalog/node/:node

GET /catalog/node/:node

Value parameters

consistencyMode
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
filter
  • Specifies the expression used to filter the queries results prior to returning the data.
node
  • Specifies the name or ID of the node to query. This is specified as part of the URL
token
  • consul token

Attributes

Returns
  • This endpoint returns the node's registered services.
Inherited from:
Catalog
def getNodeChecks(node: String, dc: Option[String], filter: Option[String], consistencyMode: ConsistencyMode, token: Option[String]): F[Result[List[HealthCheck]]]

GET /health/node/:node This endpoint returns the checks specific to the node provided on the path.

GET /health/node/:node This endpoint returns the checks specific to the node provided on the path.

Value parameters

consistencyMode
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
filter
  • Specifies the expression used to filter the queries results prior to returning the data.
node
  • Specifies the name or ID of the node to query. This is specified as part of the URL
token
  • consul token

Attributes

Returns
  • checks specific to the node provided on the path.
Inherited from:
Health
def getNodeCoordinate(node: String, dc: Option[String], consistencyMode: ConsistencyMode, token: Option[String]): F[Result[Option[List[NodeCoordinate]]]]

GET /coordinate/node/:node

GET /coordinate/node/:node

Value parameters

consistencyMode
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
node
  • node id
token
  • consul token

Attributes

Returns
  • This endpoint returns the LAN network coordinates for the given node.
Inherited from:
Coordinate
def getNodeCoordinates(dc: Option[String], consistencyMode: ConsistencyMode, token: Option[String]): F[Result[List[NodeCoordinate]]]

GET /coordinate/nodes

GET /coordinate/nodes

Value parameters

consistencyMode
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
token
  • consul token

Attributes

Returns
  • This endpoint returns the LAN network coordinates for all nodes in a given datacenter.
Inherited from:
Coordinate
def getNodesForConnectCapableService(service: String, dc: Option[String], near: Option[String], tag: Option[String], nodeMeta: Option[String], passing: Boolean, filter: Option[String], token: Option[String]): F[Result[List[ServiceEntry]]]

GET /health/connect/:service This endpoint returns the nodes providing a Connect-capable service in a given datacenter. This will include both proxies and native integrations.

GET /health/connect/:service This endpoint returns the nodes providing a Connect-capable service in a given datacenter. This will include both proxies and native integrations.

Value parameters

dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
filter
  • Specifies the expression used to filter the queries results prior to returning the data.
near
  • Specifies to sort the resulting list in ascending order based on the estimated round trip time from that node. Passing ?near=_agent will use the agent's node for the sort. Passing ?near=_ip will use the source IP of the request or the value of the X-Forwarded-For header to lookup the node to use for the sort. If this is not present, the default behavior will shuffle the nodes randomly each time the query is executed.
nodeMeta
  • Specifies a desired node metadata key/value pair of the form key:value. This parameter can be specified multiple times, and will filter the results to nodes with the specified key/value pairs. This is specified as part of the URL as a query parameter.
passing
  • Specifies that the server should return only nodes with all checks in the passing state. This can be used to avoid additional filtering on the client side.
tag
  • Specifies the tag to filter the list. This is specified as part of the URL as a query parameter. Can be used multiple times for additional filtering, returning only the results that include all of the tag values provided.
token
  • consul token

Attributes

Inherited from:
Health
def getRaftLeader(dc: Option[String], token: Option[String]): F[Result[String]]

GET /status/leader

GET /status/leader

Value parameters

dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter.
token
  • Consul token

Attributes

Returns
  • Raft leader for the datacenter in which the agent is running.
Inherited from:
Status
def getRaftPeers(dc: Option[String], token: Option[String]): F[Result[List[String]]]

GET /status/peers

GET /status/peers

Value parameters

dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter.
token
  • Consul token

Attributes

Returns
  • Raft peers for the datacenter in which the the agent is running. This list of peers is strongly consistent and can be useful in determining when a given server has successfully joined the cluster.
Inherited from:
Status
def getRawValueByKey(key: String, dc: Option[String], consistencyMode: ConsistencyMode, token: Option[String]): F[Result[Option[String]]]

GET /kv/:key?raw

GET /kv/:key?raw

Value parameters

consistencyMode
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
key
  • Specifies the path of the key to read.
token
  • consul token

Attributes

Returns
  • raw value of specified key
Inherited from:
KVStore
def getServiceChecks(service: String, dc: Option[String], near: Option[String], nodeMeta: Option[String], filter: Option[String], consistencyMode: ConsistencyMode, token: Option[String]): F[Result[List[HealthCheck]]]

GET /health/checks/:service This endpoint returns the checks associated with the service provided on the path.

GET /health/checks/:service This endpoint returns the checks associated with the service provided on the path.

Value parameters

consistencyMode
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
filter
  • Specifies the expression used to filter the queries results prior to returning the data.
near
  • Specifies to sort the resulting list in ascending order based on the estimated round trip time from that node. Passing ?near=_agent will use the agent's node for the sort. Passing ?near=_ip will use the source IP of the request or the value of the X-Forwarded-For header to lookup the node to use for the sort. If this is not present, the default behavior will shuffle the nodes randomly each time the query is executed.
nodeMeta
  • Specifies a desired node metadata key/value pair of the form key:value. This parameter can be specified multiple times, and will filter the results to nodes with the specified key/value pairs. This is specified as part of the URL as a query parameter.
service
  • Specifies the service to list checks for. This is provided as part of the URL.
token
  • consul token

Attributes

Returns
  • checks associated with the service provided on the path.
Inherited from:
Health
def getSessionInfo(sessionId: SessionId, dc: Option[String], consistencyMode: ConsistencyMode, token: Option[String]): F[Result[List[SessionInfo]]]

GET /session/info/:uuid This endpoint returns the requested session information.

GET /session/info/:uuid This endpoint returns the requested session information.

Value parameters

consistencyMode
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
sessionId
  • session id
token
  • consul token

Attributes

Returns
  • session info if session exists otherwise None
Inherited from:
Session
def getValueByKey(key: String, dc: Option[String], consistencyMode: ConsistencyMode, token: Option[String]): F[Result[Option[KVPair]]]

GET /kv/:key This endpoint returns the specified key.

GET /kv/:key This endpoint returns the specified key.

Value parameters

consistencyMode
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
key
  • Specifies the path of the key to read.
token
  • consul token

Attributes

Returns
  • value or None
Inherited from:
KVStore
def getValuesByKeyPath(path: String, dc: Option[String], consistencyMode: ConsistencyMode, token: Option[String]): F[Result[Option[List[KVPair]]]]

GET /kv/:key?recurse recurse - Specifies to get all keys which have the specified prefix.

GET /kv/:key?recurse recurse - Specifies to get all keys which have the specified prefix.

Value parameters

consistencyMode
dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
path
  • Specifies the path of the key to read.
token
  • consul token

Attributes

Returns
  • list of KV pairs
Inherited from:
KVStore
def joinAgent(address: String, wan: Option[Boolean], token: Option[String]): F[Result[Unit]]

PUT /agent/join/:address This endpoint instructs the agent to attempt to connect to a given address.

PUT /agent/join/:address This endpoint instructs the agent to attempt to connect to a given address.

Value parameters

address
  • Specifies the address of the other agent to join. This is specified as part of the URL.
token
  • consul token
wan
  • Specifies to list WAN members instead of the LAN members (which is the default). This is only eligible for agents running in server mode. This is specified as part of the URL as a query parameter.

Attributes

Inherited from:
Agent
def registerAgentCheck(check: Check, token: Option[String]): F[Result[Unit]]

PUT /agent/check/register This endpoint adds a new check to the local agent. Checks may be of script, HTTP, TCP, or TTL type.

PUT /agent/check/register This endpoint adds a new check to the local agent. Checks may be of script, HTTP, TCP, or TTL type.

Value parameters

check
  • new agent check
token
  • consul token

Attributes

Inherited from:
Agent
def registerAgentService(service: NewService, replaceExistingChecks: Boolean, token: Option[String]): F[Result[Unit]]

PUT /agent/service/register This endpoint adds a new service, with optional health checks, to the local agent.

PUT /agent/service/register This endpoint adds a new service, with optional health checks, to the local agent.

Value parameters

replaceExistingChecks
  • Missing healthchecks from the request will be deleted from the agent. Using this parameter allows to idempotently register a service and its checks without having to manually deregister checks.
service
  • service definition
token
  • consul token

Attributes

Inherited from:
Agent
def registerEntity(value: NodeRegistration, token: Option[String]): F[Result[Unit]]

PUT /catalog/register This endpoint is a low-level mechanism for registering or updating entries in the catalog.

PUT /catalog/register This endpoint is a low-level mechanism for registering or updating entries in the catalog.

Value parameters

token
  • consul token
value
  • new entity

Attributes

Returns
  • unit
Inherited from:
Catalog
def reloadAgent(token: Option[String]): F[Result[Unit]]

PUT /agent/reload This endpoint instructs the agent to reload its configuration.

PUT /agent/reload This endpoint instructs the agent to reload its configuration.

Value parameters

token
  • consul token

Attributes

Inherited from:
Agent
def renewSession(sessionId: SessionId, dc: Option[String], token: Option[String]): F[Result[Option[SessionInfo]]]

PUT /session/renew/:uuid This endpoint renews the given session. This is used with sessions that have a TTL, and it extends the expiration by the TTL.

PUT /session/renew/:uuid This endpoint renews the given session. This is used with sessions that have a TTL, and it extends the expiration by the TTL.

Value parameters

dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
sessionId
  • Specifies the UUID of the session to renew. This is required and is specified as part of the URL path.
token
  • consul token

Attributes

Returns
  • updated session or None if session does not exist
Inherited from:
Session
def setAgentMaintenanceMode(enable: Boolean, reason: Option[String], token: Option[String]): F[Result[Unit]]

PUT /agent/maintenance This endpoint places the agent into "maintenance mode". During maintenance mode, the node will be marked as unavailable and will not be present in DNS or API queries. This API call is idempotent.

PUT /agent/maintenance This endpoint places the agent into "maintenance mode". During maintenance mode, the node will be marked as unavailable and will not be present in DNS or API queries. This API call is idempotent.

Value parameters

enable
  • Specifies whether to enable or disable maintenance mode. This is specified as part of the URL as a query string parameter.
reason
  • Specifies a text string explaining the reason for placing the node into maintenance mode. This is simply to aid human operators. If no reason is provided, a default value will be used instead. This is specified as part of the URL as a query string parameter, and, as such, must be URI-encoded.
token
  • consul token

Attributes

Inherited from:
Agent
def setAgentServiceMaintenanceMode(serviceId: String, enable: Boolean, reason: Option[String], token: Option[String]): F[Result[Unit]]

PUT /agent/service/maintenance/:service_id This endpoint places a given service into "maintenance mode". During maintenance mode, the service will be marked as unavailable and will not be present in DNS or API queries. This API call is idempotent. Maintenance mode is persistent and will be automatically restored on agent restart.

PUT /agent/service/maintenance/:service_id This endpoint places a given service into "maintenance mode". During maintenance mode, the service will be marked as unavailable and will not be present in DNS or API queries. This API call is idempotent. Maintenance mode is persistent and will be automatically restored on agent restart.

Value parameters

enable
  • Specifies whether to enable or disable maintenance mode. This is specified as part of the URL as a query string parameter.
reason
  • Specifies a text string explaining the reason for placing the node into maintenance mode. This is simply to aid human operators. If no reason is provided, a default value will be used instead. This is specified as part of the URL as a query string parameter, and, as such, must be URI-encoded.
token
  • consul token

Attributes

Inherited from:
Agent
def setAgentTtlCheckFail(checkId: String, note: Option[String], token: Option[String]): F[Result[Unit]]

PUT /agent/check/fail/:check_id This endpoint is used with a TTL type check to set the status of the check to critical and to reset the TTL clock.

PUT /agent/check/fail/:check_id This endpoint is used with a TTL type check to set the status of the check to critical and to reset the TTL clock.

Value parameters

checkId
  • check id
note
  • Specifies a human-readable message. This will be passed through to the check's Output field.
token
  • consul token

Attributes

Inherited from:
Agent
def setAgentTtlCheckPass(checkId: String, note: Option[String], token: Option[String]): F[Result[Unit]]

PUT /agent/check/pass/:check_id This endpoint is used with a TTL type check to set the status of the check to passing and to reset the TTL clock.

PUT /agent/check/pass/:check_id This endpoint is used with a TTL type check to set the status of the check to passing and to reset the TTL clock.

Value parameters

checkId
  • check id
note
  • Specifies a human-readable message. This will be passed through to the check's Output field.
token
  • consul token

Attributes

Inherited from:
Agent
def setAgentTtlCheckWarn(checkId: String, note: Option[String], token: Option[String]): F[Result[Unit]]

PUT /agent/check/warn/:check_id This endpoint is used with a TTL type check to set the status of the check to warning and to reset the TTL clock.

PUT /agent/check/warn/:check_id This endpoint is used with a TTL type check to set the status of the check to warning and to reset the TTL clock.

Value parameters

checkId
  • check id
note
  • Specifies a human-readable message. This will be passed through to the check's Output field.
token
  • consul token

Attributes

Inherited from:
Agent
def updateAgentDefaultToken(newToken: Token, token: Option[String]): F[Result[Unit]]

PUT /agent/token/default This endpoint updates the ACL tokens currently in use by the agent.

PUT /agent/token/default This endpoint updates the ACL tokens currently in use by the agent.

Value parameters

newToken
  • new consul token
token
  • consul token

Attributes

Inherited from:
Agent
def updateAgentMasterToken(newToken: Token, token: Option[String]): F[Result[Unit]]

PUT /agent/token/agent_master This endpoint updates the ACL tokens currently in use by the agent.

PUT /agent/token/agent_master This endpoint updates the ACL tokens currently in use by the agent.

Value parameters

newToken
  • new consul token
token
  • consul token

Attributes

Inherited from:
Agent
def updateAgentReplicationToken(newToken: Token, token: Option[String]): F[Result[Unit]]

PUT /agent/token/replication This endpoint updates the ACL tokens currently in use by the agent.

PUT /agent/token/replication This endpoint updates the ACL tokens currently in use by the agent.

Value parameters

newToken
  • new consul token
token
  • consul token

Attributes

Inherited from:
Agent
def updateAgentToken(newToken: Token, token: Option[String]): F[Result[Unit]]

PUT /agent/token/agent This endpoint updates the ACL tokens currently in use by the agent.

PUT /agent/token/agent This endpoint updates the ACL tokens currently in use by the agent.

Value parameters

newToken
  • new consul token
token
  • consul token

Attributes

Inherited from:
Agent
def updateAgentTtlCheck(checkId: String, checkUpdate: CheckUpdate, token: Option[String]): F[Result[Unit]]

PUT /agent/check/update/:check_id This endpoint is used with a TTL type check to set the status of the check and to reset the TTL clock.

PUT /agent/check/update/:check_id This endpoint is used with a TTL type check to set the status of the check and to reset the TTL clock.

Value parameters

checkId
  • Specifies the unique ID of the check to use. This is specified as part of the URL.
checkUpdate
  • check updates
token
  • consul token

Attributes

Inherited from:
Agent
def updateNodeCoordinate(nodeCoordinate: NodeCoordinate, dc: Option[String], token: Option[String]): F[Result[Unit]]

PUT /coordinate/update This endpoint updates the LAN network coordinates for a node in a given datacenter.

PUT /coordinate/update This endpoint updates the LAN network coordinates for a node in a given datacenter.

Value parameters

dc
  • Specifies the datacenter to query. This will default to the datacenter of the agent being queried. This is specified as part of the URL as a query parameter. Using this across datacenters is not recommended.
nodeCoordinate
  • new coordinates
token
  • consul token

Attributes

Returns
  • unit
Inherited from:
Coordinate

Concrete fields

protected val sttpBackend: SttpBackend[F, Any]
protected val url: String

Implicits

Implicits

implicit protected val jsonDecoder: JsonDecoder
implicit protected val jsonEncoder: JsonEncoder