Synchronous consul client.
Synchronous consul client.
(consul {:keys [scheme host port]
:or {scheme :http host "localhost" port 8500}
:as arg-map})
Create a consul client, suitable for synchronous usage
with invoke
, or asynchronous usage with consul.client.async/invoke
.
Use ops
to fetch a list of supported operations, and the arguments
they take.
Argument map may contain the following keys:
:scheme
-- :http
or :https
. Defaults to :http
.:host
-- host to connect to. Defaults to localhost.:port
-- port to connect to. Defaults to 8500.:conn-pool
-- an aleph.http/connection-pool
.Create a consul client, suitable for synchronous usage with [[invoke]], or asynchronous usage with [[consul.client.async/invoke]]. Use [[ops]] to fetch a list of supported operations, and the arguments they take. Argument map may contain the following keys: * `:scheme` -- `:http` or `:https`. Defaults to `:http`. * `:host` -- host to connect to. Defaults to localhost. * `:port` -- port to connect to. Defaults to 8500. * `:conn-pool` -- an `aleph.http/connection-pool`.
(invoke client arg-map)
Invoke a consul API call.
Arguments in arg-map include:
:op
A keyword naming the operation to invoke. Required.:request
A map containing the request to pass; required based on operation -- see ops
for
a way to discover what arguments are required.:headers
A map of strings to strings, HTTP headers to include
in the request.:decode-key-fn
-- function to use to decode JSON keys; default leaves keys as is; can be
true
to keywordize keys, or any arbitrary 1-arg function.Returns a map of the response, possibly with a :body
, on success;
returns an anomaly map on failure.
Invoke a consul API call. Arguments in arg-map include: * `:op` A keyword naming the operation to invoke. Required. * `:request` A map containing the request to pass; required based on operation -- see [[ops]] for a way to discover what arguments are required. * `:headers` A map of strings to strings, HTTP headers to include in the request. * `:decode-key-fn` -- function to use to decode JSON keys; default leaves keys as is; can be `true` to keywordize keys, or any arbitrary 1-arg function. Returns a map of the response, possibly with a `:body`, on success; returns an anomaly map on failure.
(ops client)
Return a map of operations this client supports.
Return a map of operations this client supports.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close