/*
 * Copyright (c) 2016 The original author or authors
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * and Apache License v2.0 which accompanies this distribution.
 *
 *      The Eclipse Public License is available at
 *      http://www.eclipse.org/legal/epl-v10.html
 *
 *      The Apache License v2.0 is available at
 *      http://www.opensource.org/licenses/apache2.0.php
 *
 * You may elect to redistribute this code under either of these licenses.
 */
package io.vertx.ext.consul;

import io.vertx.codegen.annotations.Fluent;
import io.vertx.codegen.annotations.VertxGen;
import io.vertx.core.AsyncResult;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.consul.impl.ConsulClientImpl;

import java.util.List;

A Vert.x service used to interact with Consul.
Author:Ruslan Sennov
/** * A Vert.x service used to interact with Consul. * * @author <a href="mailto:ruslan.sennov@gmail.com">Ruslan Sennov</a> */
@VertxGen public interface ConsulClient {
Create a Consul client with default options.
Params:
  • vertx – the Vert.x instance
Returns:the client
/** * Create a Consul client with default options. * * @param vertx the Vert.x instance * @return the client */
static ConsulClient create(Vertx vertx) { return new ConsulClientImpl(vertx, new ConsulClientOptions()); }
Create a Consul client.
Params:
  • vertx – the Vert.x instance
  • options – the options
Returns:the client
/** * Create a Consul client. * * @param vertx the Vert.x instance * @param options the options * @return the client */
static ConsulClient create(Vertx vertx, ConsulClientOptions options) { return new ConsulClientImpl(vertx, options); }
Returns the configuration and member information of the local agent
Params:
  • resultHandler – will be provided with the configuration and member information of the local agent
See Also:
Returns:reference to this, for fluency
/** * Returns the configuration and member information of the local agent * * @param resultHandler will be provided with the configuration and member information of the local agent * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/agent.html#read-configuration">/v1/agent/self</a> endpoint */
@Fluent ConsulClient agentInfo(Handler<AsyncResult<JsonObject>> resultHandler);
Like agentInfo(Handler<AsyncResult<JsonObject>>) but returns a Future of the asynchronous result.
/** * Like {@link #agentInfo(Handler)} but returns a {@code Future} of the asynchronous result. */
Future<JsonObject> agentInfo();
Returns the LAN network coordinates for all nodes in a given DC
Params:
  • resultHandler – will be provided with network coordinates of nodes in datacenter
See Also:
Returns:reference to this, for fluency
/** * Returns the LAN network coordinates for all nodes in a given DC * * @param resultHandler will be provided with network coordinates of nodes in datacenter * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/coordinate.html#read-lan-coordinates">/v1/coordinate/nodes</a> endpoint */
@Fluent ConsulClient coordinateNodes(Handler<AsyncResult<CoordinateList>> resultHandler);
Like coordinateNodes(Handler<AsyncResult<CoordinateList>>) but returns a Future of the asynchronous result.
/** * Like {@link #coordinateNodes(Handler)} but returns a {@code Future} of the asynchronous result. */
Future<CoordinateList> coordinateNodes();
Returns the LAN network coordinates for all nodes in a given DC This is blocking query unlike coordinateNodes(Handler<AsyncResult<CoordinateList>>)
Params:
  • options – the blocking options
  • resultHandler – will be provided with network coordinates of nodes in datacenter
See Also:
Returns:reference to this, for fluency
/** * Returns the LAN network coordinates for all nodes in a given DC * This is blocking query unlike {@link ConsulClient#coordinateNodes(Handler)} * * @param options the blocking options * @param resultHandler will be provided with network coordinates of nodes in datacenter * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/coordinate.html#read-lan-coordinates">/v1/coordinate/nodes</a> endpoint */
@Fluent ConsulClient coordinateNodesWithOptions(BlockingQueryOptions options, Handler<AsyncResult<CoordinateList>> resultHandler); /** * Like {@link #coordinateNodesWithOptions(BlockingQueryOptions, Handler)} but returns a {@code Future} of the asynchronous result. */ Future<CoordinateList> coordinateNodesWithOptions(BlockingQueryOptions options);
Returns the WAN network coordinates for all Consul servers, organized by DCs
Params:
  • resultHandler – will be provided with network coordinates for all Consul servers
See Also:
Returns:reference to this, for fluency
/** * Returns the WAN network coordinates for all Consul servers, organized by DCs * * @param resultHandler will be provided with network coordinates for all Consul servers * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/coordinate.html#read-wan-coordinates">/v1/coordinate/datacenters</a> endpoint */
@Fluent ConsulClient coordinateDatacenters(Handler<AsyncResult<List<DcCoordinates>>> resultHandler);
Like coordinateDatacenters(Handler<AsyncResult<List<DcCoordinates>>>) but returns a Future of the asynchronous result.
/** * Like {@link #coordinateDatacenters(Handler)} but returns a {@code Future} of the asynchronous result. */
Future<List<DcCoordinates>> coordinateDatacenters();
Returns the list of keys that corresponding to the specified key prefix.
Params:
  • keyPrefix – the prefix
  • resultHandler – will be provided with keys list
See Also:
Returns:reference to this, for fluency
/** * Returns the list of keys that corresponding to the specified key prefix. * * @param keyPrefix the prefix * @param resultHandler will be provided with keys list * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/kv.html#read-key">/v1/kv/:key</a> endpoint */
@Fluent ConsulClient getKeys(String keyPrefix, Handler<AsyncResult<List<String>>> resultHandler);
Like getKeys(String, Handler<AsyncResult<List<String>>>) but returns a Future of the asynchronous result.
/** * Like {@link #getKeys(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<List<String>> getKeys(String keyPrefix);
Returns the list of keys that corresponding to the specified key prefix.
Params:
  • keyPrefix – the prefix
  • options – the blocking options
  • resultHandler – will be provided with keys list
See Also:
Returns:reference to this, for fluency
/** * Returns the list of keys that corresponding to the specified key prefix. * * @param keyPrefix the prefix * @param options the blocking options * @param resultHandler will be provided with keys list * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/kv.html#read-key">/v1/kv/:key</a> endpoint */
@Fluent ConsulClient getKeysWithOptions(String keyPrefix, BlockingQueryOptions options, Handler<AsyncResult<List<String>>> resultHandler); /** * Like {@link #getKeysWithOptions(String, BlockingQueryOptions, Handler)} but returns a {@code Future} of the asynchronous result. */ Future<List<String>> getKeysWithOptions(String keyPrefix, BlockingQueryOptions options);
Returns key/value pair that corresponding to the specified key. An empty KeyValue object will be returned if no such key is found.
Params:
  • key – the key
  • resultHandler – will be provided with key/value pair
See Also:
Returns:reference to this, for fluency
/** * Returns key/value pair that corresponding to the specified key. * An empty {@link KeyValue} object will be returned if no such key is found. * * @param key the key * @param resultHandler will be provided with key/value pair * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/kv.html#read-key">/v1/kv/:key</a> endpoint */
@Fluent ConsulClient getValue(String key, Handler<AsyncResult<KeyValue>> resultHandler);
Like getValue(String, Handler<AsyncResult<KeyValue>>) but returns a Future of the asynchronous result.
/** * Like {@link #getValue(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<KeyValue> getValue(String key);
Returns key/value pair that corresponding to the specified key. An empty KeyValue object will be returned if no such key is found. This is blocking query unlike getValue(String, Handler<AsyncResult<KeyValue>>)
Params:
  • key – the key
  • options – the blocking options
  • resultHandler – will be provided with key/value pair
See Also:
Returns:reference to this, for fluency
/** * Returns key/value pair that corresponding to the specified key. * An empty {@link KeyValue} object will be returned if no such key is found. * This is blocking query unlike {@link ConsulClient#getValue(String, Handler)} * * @param key the key * @param options the blocking options * @param resultHandler will be provided with key/value pair * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/kv.html#read-key">/v1/kv/:key</a> endpoint */
@Fluent ConsulClient getValueWithOptions(String key, BlockingQueryOptions options, Handler<AsyncResult<KeyValue>> resultHandler);
Like getValueWithOptions(String, BlockingQueryOptions, Handler<AsyncResult<KeyValue>>) but returns a Future of the asynchronous result.
/** * Like {@link #getValueWithOptions(String, BlockingQueryOptions, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<KeyValue> getValueWithOptions(String key, BlockingQueryOptions options);
Remove the key/value pair that corresponding to the specified key
Params:
  • key – the key
  • resultHandler – will be called on complete
See Also:
Returns:reference to this, for fluency
/** * Remove the key/value pair that corresponding to the specified key * * @param key the key * @param resultHandler will be called on complete * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/kv.html#delete-key">/v1/kv/:key</a> endpoint */
@Fluent ConsulClient deleteValue(String key, Handler<AsyncResult<Void>> resultHandler);
Like deleteValue(String, Handler<AsyncResult<Void>>) but returns a Future of the asynchronous result.
/** * Like {@link #deleteValue(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Void> deleteValue(String key);
Returns the list of key/value pairs that corresponding to the specified key prefix. An empty KeyValueList object will be returned if no such key prefix is found.
Params:
  • keyPrefix – the prefix
  • resultHandler – will be provided with list of key/value pairs
See Also:
Returns:reference to this, for fluency
/** * Returns the list of key/value pairs that corresponding to the specified key prefix. * An empty {@link KeyValueList} object will be returned if no such key prefix is found. * * @param keyPrefix the prefix * @param resultHandler will be provided with list of key/value pairs * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/kv.html#read-key">/v1/kv/:key</a> endpoint */
@Fluent ConsulClient getValues(String keyPrefix, Handler<AsyncResult<KeyValueList>> resultHandler);
Like getValues(String, Handler<AsyncResult<KeyValueList>>) but returns a Future of the asynchronous result.
/** * Like {@link #getValues(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<KeyValueList> getValues(String keyPrefix);
Returns the list of key/value pairs that corresponding to the specified key prefix. An empty KeyValueList object will be returned if no such key prefix is found. This is blocking query unlike getValues(String, Handler<AsyncResult<KeyValueList>>)
Params:
  • keyPrefix – the prefix
  • options – the blocking options
  • resultHandler – will be provided with list of key/value pairs
See Also:
Returns:reference to this, for fluency
/** * Returns the list of key/value pairs that corresponding to the specified key prefix. * An empty {@link KeyValueList} object will be returned if no such key prefix is found. * This is blocking query unlike {@link ConsulClient#getValues(String, Handler)} * * @param keyPrefix the prefix * @param options the blocking options * @param resultHandler will be provided with list of key/value pairs * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/kv.html#read-key">/v1/kv/:key</a> endpoint */
@Fluent ConsulClient getValuesWithOptions(String keyPrefix, BlockingQueryOptions options, Handler<AsyncResult<KeyValueList>> resultHandler); /** * Like {@link #getValuesWithOptions(String, BlockingQueryOptions, Handler)} but returns a {@code Future} of the asynchronous result. */ Future<KeyValueList> getValuesWithOptions(String keyPrefix, BlockingQueryOptions options);
Removes all the key/value pair that corresponding to the specified key prefix
Params:
  • keyPrefix – the prefix
  • resultHandler – will be called on complete
See Also:
Returns:reference to this, for fluency
/** * Removes all the key/value pair that corresponding to the specified key prefix * * @param keyPrefix the prefix * @param resultHandler will be called on complete * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/kv.html#delete-key">/v1/kv/:key</a> endpoint */
@Fluent ConsulClient deleteValues(String keyPrefix, Handler<AsyncResult<Void>> resultHandler);
Like deleteValues(String, Handler<AsyncResult<Void>>) but returns a Future of the asynchronous result.
/** * Like {@link #deleteValues(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Void> deleteValues(String keyPrefix);
Adds specified key/value pair
Params:
  • key – the key
  • value – the value
  • resultHandler – will be provided with success of operation
See Also:
Returns:reference to this, for fluency
/** * Adds specified key/value pair * * @param key the key * @param value the value * @param resultHandler will be provided with success of operation * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/kv.html#create-update-key">/v1/kv/:key</a> endpoint */
@Fluent ConsulClient putValue(String key, String value, Handler<AsyncResult<Boolean>> resultHandler);
Like putValue(String, String, Handler<AsyncResult<Boolean>>) but returns a Future of the asynchronous result.
/** * Like {@link #putValue(String, String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Boolean> putValue(String key, String value);
Params:
  • key – the key
  • value – the value
  • options – options used to push pair
  • resultHandler – will be provided with success of operation
See Also:
Returns:reference to this, for fluency
/** * @param key the key * @param value the value * @param options options used to push pair * @param resultHandler will be provided with success of operation * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/kv.html#create-update-key">/v1/kv/:key</a> endpoint */
@Fluent ConsulClient putValueWithOptions(String key, String value, KeyValueOptions options, Handler<AsyncResult<Boolean>> resultHandler); /** * Like {@link #putValueWithOptions(String, String, KeyValueOptions, Handler)} but returns a {@code Future} of the asynchronous result. */ Future<Boolean> putValueWithOptions(String key, String value, KeyValueOptions options);
Manages multiple operations inside a single, atomic transaction.
Params:
  • request – transaction request
  • resultHandler – will be provided with result of transaction
See Also:
Returns:reference to this, for fluency
/** * Manages multiple operations inside a single, atomic transaction. * * @param request transaction request * @param resultHandler will be provided with result of transaction * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/txn.html">/v1/txn</a> endpoint */
@Fluent ConsulClient transaction(TxnRequest request, Handler<AsyncResult<TxnResponse>> resultHandler);
Like transaction(TxnRequest, Handler<AsyncResult<TxnResponse>>) but returns a Future of the asynchronous result.
/** * Like {@link #transaction(TxnRequest, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<TxnResponse> transaction(TxnRequest request);
Create new Acl token
Params:
  • token – properties of the token
  • idHandler – will be provided with ID of created token
See Also:
Returns:reference to this, for fluency
/** * Create new Acl token * * @param token properties of the token * @param idHandler will be provided with ID of created token * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/acl.html#create-acl-token">/v1/acl/create</a> endpoint */
@Fluent ConsulClient createAclToken(AclToken token, Handler<AsyncResult<String>> idHandler);
Like createAclToken(AclToken, Handler<AsyncResult<String>>) but returns a Future of the asynchronous result.
/** * Like {@link #createAclToken(AclToken, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<String> createAclToken(AclToken token);
Update Acl token
Params:
  • token – properties of the token to be updated
  • idHandler – will be provided with ID of updated
See Also:
Returns:reference to this, for fluency
/** * Update Acl token * * @param token properties of the token to be updated * @param idHandler will be provided with ID of updated * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/acl.html#update-acl-token">/v1/acl/update</a> endpoint */
@Fluent ConsulClient updateAclToken(AclToken token, Handler<AsyncResult<String>> idHandler);
Like updateAclToken(AclToken, Handler<AsyncResult<String>>) but returns a Future of the asynchronous result.
/** * Like {@link #updateAclToken(AclToken, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<String> updateAclToken(AclToken token);
Clone Acl token
Params:
  • id – the ID of token to be cloned
  • idHandler – will be provided with ID of cloned token
See Also:
Returns:reference to this, for fluency
/** * Clone Acl token * * @param id the ID of token to be cloned * @param idHandler will be provided with ID of cloned token * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/acl.html#clone-acl-token">/v1/acl/clone/:uuid</a> endpoint */
@Fluent ConsulClient cloneAclToken(String id, Handler<AsyncResult<String>> idHandler);
Like cloneAclToken(String, Handler<AsyncResult<String>>) but returns a Future of the asynchronous result.
/** * Like {@link #cloneAclToken(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<String> cloneAclToken(String id);
Get list of Acl token
Params:
  • resultHandler – will be provided with list of tokens
See Also:
Returns:reference to this, for fluency
/** * Get list of Acl token * * @param resultHandler will be provided with list of tokens * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/acl.html#list-acls">/v1/acl/list</a> endpoint */
@Fluent ConsulClient listAclTokens(Handler<AsyncResult<List<AclToken>>> resultHandler);
Like listAclTokens(Handler<AsyncResult<List<AclToken>>>) but returns a Future of the asynchronous result.
/** * Like {@link #listAclTokens(Handler)} but returns a {@code Future} of the asynchronous result. */
Future<List<AclToken>> listAclTokens();
Get info of Acl token
Params:
  • id – the ID of token
  • tokenHandler – will be provided with token
See Also:
Returns:reference to this, for fluency
/** * Get info of Acl token * * @param id the ID of token * @param tokenHandler will be provided with token * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/acl.html#read-acl-token">/v1/acl/info/:uuid</a> endpoint */
@Fluent ConsulClient infoAclToken(String id, Handler<AsyncResult<AclToken>> tokenHandler);
Like infoAclToken(String, Handler<AsyncResult<AclToken>>) but returns a Future of the asynchronous result.
/** * Like {@link #infoAclToken(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<AclToken> infoAclToken(String id);
Destroy Acl token
Params:
  • id – the ID of token
  • resultHandler – will be called on complete
See Also:
Returns:reference to this, for fluency
/** * Destroy Acl token * * @param id the ID of token * @param resultHandler will be called on complete * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/acl.html#delete-acl-token">/v1/acl/destroy/:uuid</a> endpoint */
@Fluent ConsulClient destroyAclToken(String id, Handler<AsyncResult<Void>> resultHandler);
Like destroyAclToken(String, Handler<AsyncResult<Void>>) but returns a Future of the asynchronous result.
/** * Like {@link #destroyAclToken(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Void> destroyAclToken(String id);
Fires a new user event
Params:
  • name – name of event
  • resultHandler – will be provided with properties of event
See Also:
Returns:reference to this, for fluency
/** * Fires a new user event * * @param name name of event * @param resultHandler will be provided with properties of event * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/event.html#fire-event">/v1/event/fire/:name</a> endpoint */
@Fluent ConsulClient fireEvent(String name, Handler<AsyncResult<Event>> resultHandler);
Like fireEvent(String, Handler<AsyncResult<Event>>) but returns a Future of the asynchronous result.
/** * Like {@link #fireEvent(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Event> fireEvent(String name);
Fires a new user event
Params:
  • name – name of event
  • options – options used to create event
  • resultHandler – will be provided with properties of event
See Also:
Returns:reference to this, for fluency
/** * Fires a new user event * * @param name name of event * @param options options used to create event * @param resultHandler will be provided with properties of event * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/event.html#fire-event">/v1/event/fire/:name</a> endpoint */
@Fluent ConsulClient fireEventWithOptions(String name, EventOptions options, Handler<AsyncResult<Event>> resultHandler);
Like fireEventWithOptions(String, EventOptions, Handler<AsyncResult<Event>>) but returns a Future of the asynchronous result.
/** * Like {@link #fireEventWithOptions(String, EventOptions, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Event> fireEventWithOptions(String name, EventOptions options);
Returns the most recent events known by the agent
Params:
  • resultHandler – will be provided with list of events
See Also:
Returns:reference to this, for fluency
/** * Returns the most recent events known by the agent * * @param resultHandler will be provided with list of events * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/event.html#list-events">/v1/event/list</a> endpoint */
@Fluent ConsulClient listEvents(Handler<AsyncResult<EventList>> resultHandler);
Like listEvents(Handler<AsyncResult<EventList>>) but returns a Future of the asynchronous result.
/** * Like {@link #listEvents(Handler)} but returns a {@code Future} of the asynchronous result. */
Future<EventList> listEvents();
Returns the most recent events known by the agent. This is blocking query unlike listEvents(Handler<AsyncResult<EventList>>). However, the semantics of this endpoint are slightly different. Most blocking queries provide a monotonic index and block until a newer index is available. This can be supported as a consequence of the total ordering of the consensus protocol. With gossip, there is no ordering, and instead X-Consul-Index maps to the newest event that matches the query.

In practice, this means the index is only useful when used against a single agent and has no meaning globally. Because Consul defines the index as being opaque, clients should not be expecting a natural ordering either.

Params:
  • resultHandler – will be provided with list of events
  • options – the blocking options
See Also:
Returns:reference to this, for fluency
/** * Returns the most recent events known by the agent. * This is blocking query unlike {@link ConsulClient#listEvents(Handler)}. However, the semantics of this endpoint * are slightly different. Most blocking queries provide a monotonic index and block until a newer index is available. * This can be supported as a consequence of the total ordering of the consensus protocol. With gossip, * there is no ordering, and instead {@code X-Consul-Index} maps to the newest event that matches the query. * <p> * In practice, this means the index is only useful when used against a single agent and has no meaning globally. * Because Consul defines the index as being opaque, clients should not be expecting a natural ordering either. * * @param resultHandler will be provided with list of events * @param options the blocking options * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/event.html#list-events">/v1/event/list</a> endpoint */
@Fluent ConsulClient listEventsWithOptions(EventListOptions options, Handler<AsyncResult<EventList>> resultHandler);
Like listEventsWithOptions(EventListOptions, Handler<AsyncResult<EventList>>) but returns a Future of the asynchronous result.
/** * Like {@link #listEventsWithOptions(EventListOptions, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<EventList> listEventsWithOptions(EventListOptions options);
Adds a new service, with an optional health check, to the local agent.
Params:
  • serviceOptions – the options of new service
  • resultHandler – will be called when complete
See Also:
Returns:reference to this, for fluency
/** * Adds a new service, with an optional health check, to the local agent. * * @param serviceOptions the options of new service * @param resultHandler will be called when complete * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/agent/service.html#register-service">/v1/agent/service/register</a> endpoint * @see ServiceOptions */
@Fluent ConsulClient registerService(ServiceOptions serviceOptions, Handler<AsyncResult<Void>> resultHandler);
Like registerService(ServiceOptions, Handler<AsyncResult<Void>>) but returns a Future of the asynchronous result.
/** * Like {@link #registerService(ServiceOptions, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Void> registerService(ServiceOptions serviceOptions);
Places a given service into "maintenance mode"
Params:
  • maintenanceOptions – the maintenance options
  • resultHandler – will be called when complete
See Also:
Returns:reference to this, for fluency
/** * Places a given service into "maintenance mode" * * @param maintenanceOptions the maintenance options * @param resultHandler will be called when complete * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/agent/service.html#enable-maintenance-mode">/v1/agent/service/maintenance/:service_id</a> endpoint * @see MaintenanceOptions */
@Fluent ConsulClient maintenanceService(MaintenanceOptions maintenanceOptions, Handler<AsyncResult<Void>> resultHandler);
Like maintenanceService(MaintenanceOptions, Handler<AsyncResult<Void>>) but returns a Future of the asynchronous result.
/** * Like {@link #maintenanceService(MaintenanceOptions, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Void> maintenanceService(MaintenanceOptions maintenanceOptions);
Remove a service from the local agent. The agent will take care of deregistering the service with the Catalog. If there is an associated check, that is also deregistered.
Params:
  • id – the ID of service
  • resultHandler – will be called when complete
See Also:
Returns:reference to this, for fluency
/** * Remove a service from the local agent. The agent will take care of deregistering the service with the Catalog. * If there is an associated check, that is also deregistered. * * @param id the ID of service * @param resultHandler will be called when complete * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/agent/service.html#deregister-service">/v1/agent/service/deregister/:service_id</a> endpoint */
@Fluent ConsulClient deregisterService(String id, Handler<AsyncResult<Void>> resultHandler);
Like deregisterService(String, Handler<AsyncResult<Void>>) but returns a Future of the asynchronous result.
/** * Like {@link #deregisterService(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Void> deregisterService(String id);
Returns the nodes providing a service
Params:
  • service – name of service
  • resultHandler – will be provided with list of nodes providing given service
See Also:
Returns:reference to this, for fluency
/** * Returns the nodes providing a service * * @param service name of service * @param resultHandler will be provided with list of nodes providing given service * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/catalog.html#list-nodes-for-service">/v1/catalog/service/:service</a> endpoint */
@Fluent ConsulClient catalogServiceNodes(String service, Handler<AsyncResult<ServiceList>> resultHandler);
Like catalogServiceNodes(String, Handler<AsyncResult<ServiceList>>) but returns a Future of the asynchronous result.
/** * Like {@link #catalogServiceNodes(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<ServiceList> catalogServiceNodes(String service);
Returns the nodes providing a service
Params:
  • service – name of service
  • options – options used to request services
  • resultHandler – will be provided with list of nodes providing given service
See Also:
Returns:reference to this, for fluency
/** * Returns the nodes providing a service * * @param service name of service * @param options options used to request services * @param resultHandler will be provided with list of nodes providing given service * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/catalog.html#list-nodes-for-service">/v1/catalog/service/:service</a> endpoint */
@Fluent ConsulClient catalogServiceNodesWithOptions(String service, ServiceQueryOptions options, Handler<AsyncResult<ServiceList>> resultHandler); /** * Like {@link #catalogServiceNodesWithOptions(String, ServiceQueryOptions, Handler)} but returns a {@code Future} of the asynchronous result. */ Future<ServiceList> catalogServiceNodesWithOptions(String service, ServiceQueryOptions options);
Return all the datacenters that are known by the Consul server
Params:
  • resultHandler – will be provided with list of datacenters
See Also:
Returns:reference to this, for fluency
/** * Return all the datacenters that are known by the Consul server * * @param resultHandler will be provided with list of datacenters * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/catalog.html#list-datacenters">/v1/catalog/datacenters</a> endpoint */
@Fluent ConsulClient catalogDatacenters(Handler<AsyncResult<List<String>>> resultHandler);
Like catalogDatacenters(Handler<AsyncResult<List<String>>>) but returns a Future of the asynchronous result.
/** * Like {@link #catalogDatacenters(Handler)} but returns a {@code Future} of the asynchronous result. */
Future<List<String>> catalogDatacenters();
Returns the nodes registered in a datacenter
Params:
  • resultHandler – will be provided with list of nodes
See Also:
Returns:reference to this, for fluency
/** * Returns the nodes registered in a datacenter * * @param resultHandler will be provided with list of nodes * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/catalog.html#list-nodes">/v1/catalog/nodes</a> endpoint */
@Fluent ConsulClient catalogNodes(Handler<AsyncResult<NodeList>> resultHandler);
Like catalogNodes(Handler<AsyncResult<NodeList>>) but returns a Future of the asynchronous result.
/** * Like {@link #catalogNodes(Handler)} but returns a {@code Future} of the asynchronous result. */
Future<NodeList> catalogNodes();
Returns the nodes registered in a datacenter
Params:
  • resultHandler – will be provided with list of nodes
  • options – options used to request nodes
See Also:
Returns:reference to this, for fluency
/** * Returns the nodes registered in a datacenter * * @param resultHandler will be provided with list of nodes * @param options options used to request nodes * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/catalog.html#list-nodes">/v1/catalog/nodes</a> endpoint */
@Fluent ConsulClient catalogNodesWithOptions(NodeQueryOptions options, Handler<AsyncResult<NodeList>> resultHandler);
Like catalogNodesWithOptions(NodeQueryOptions, Handler<AsyncResult<NodeList>>) but returns a Future of the asynchronous result.
/** * Like {@link #catalogNodesWithOptions(NodeQueryOptions, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<NodeList> catalogNodesWithOptions(NodeQueryOptions options);
Returns the checks associated with the service
Params:
  • service – the service name
  • resultHandler – will be provided with list of checks
See Also:
Returns:reference to this, for fluency
/** * Returns the checks associated with the service * * @param service the service name * @param resultHandler will be provided with list of checks * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/health.html#list-checks-for-service">/v1/health/checks/:service</a> endpoint */
@Fluent ConsulClient healthChecks(String service, Handler<AsyncResult<CheckList>> resultHandler);
Like healthChecks(String, Handler<AsyncResult<CheckList>>) but returns a Future of the asynchronous result.
/** * Like {@link #healthChecks(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<CheckList> healthChecks(String service);
Returns the checks associated with the service
Params:
  • service – the service name
  • options – options used to request checks
  • resultHandler – will be provided with list of checks
See Also:
Returns:reference to this, for fluency
/** * Returns the checks associated with the service * * @param service the service name * @param options options used to request checks * @param resultHandler will be provided with list of checks * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/health.html#list-checks-for-service">/v1/health/checks/:service</a> endpoint */
@Fluent ConsulClient healthChecksWithOptions(String service, CheckQueryOptions options, Handler<AsyncResult<CheckList>> resultHandler); /** * Like {@link #healthChecksWithOptions(String, CheckQueryOptions, Handler)} but returns a {@code Future} of the asynchronous result. */ Future<CheckList> healthChecksWithOptions(String service, CheckQueryOptions options);
Returns the checks in the specified status
Params:
  • healthState – the health state
  • resultHandler – will be provided with list of checks
See Also:
Returns:reference to this, for fluency
/** * Returns the checks in the specified status * * @param healthState the health state * @param resultHandler will be provided with list of checks * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/health.html#list-checks-in-state">/v1/health/state/:state</a> endpoint */
@Fluent ConsulClient healthState(HealthState healthState, Handler<AsyncResult<CheckList>> resultHandler);
Like healthState(HealthState, Handler<AsyncResult<CheckList>>) but returns a Future of the asynchronous result.
/** * Like {@link #healthState(HealthState, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<CheckList> healthState(HealthState healthState);
Returns the checks in the specified status
Params:
  • healthState – the health state
  • options – options used to request checks
  • resultHandler – will be provided with list of checks
See Also:
Returns:reference to this, for fluency
/** * Returns the checks in the specified status * * @param healthState the health state * @param options options used to request checks * @param resultHandler will be provided with list of checks * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/health.html#list-checks-in-state">/v1/health/state/:state</a> endpoint */
@Fluent ConsulClient healthStateWithOptions(HealthState healthState, CheckQueryOptions options, Handler<AsyncResult<CheckList>> resultHandler); /** * Like {@link #healthStateWithOptions(HealthState, CheckQueryOptions, Handler)} but returns a {@code Future} of the asynchronous result. */ Future<CheckList> healthStateWithOptions(HealthState healthState, CheckQueryOptions options);
Returns the nodes providing the service. This endpoint is very similar to the catalogServiceNodes endpoint; however, this endpoint automatically returns the status of the associated health check as well as any system level health checks.
Params:
  • service – the service name
  • passing – if true, filter results to only nodes with all checks in the passing state
  • resultHandler – will be provided with list of services
See Also:
Returns:reference to this, for fluency
/** * Returns the nodes providing the service. This endpoint is very similar to the {@link ConsulClient#catalogServiceNodes} endpoint; * however, this endpoint automatically returns the status of the associated health check as well as any system level health checks. * * @param service the service name * @param passing if true, filter results to only nodes with all checks in the passing state * @param resultHandler will be provided with list of services * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/health.html#list-nodes-for-service">/v1/health/service/:service</a> endpoint */
@Fluent ConsulClient healthServiceNodes(String service, boolean passing, Handler<AsyncResult<ServiceEntryList>> resultHandler);
Like healthServiceNodes(String, boolean, Handler<AsyncResult<ServiceEntryList>>) but returns a Future of the asynchronous result.
/** * Like {@link #healthServiceNodes(String, boolean, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<ServiceEntryList> healthServiceNodes(String service, boolean passing);
Returns the nodes providing the service. This endpoint is very similar to the catalogServiceNodesWithOptions endpoint; however, this endpoint automatically returns the status of the associated health check as well as any system level health checks.
Params:
  • service – the service name
  • passing – if true, filter results to only nodes with all checks in the passing state
  • options – options used to request services
  • resultHandler – will be provided with list of services
See Also:
Returns:reference to this, for fluency
/** * Returns the nodes providing the service. This endpoint is very similar to the {@link ConsulClient#catalogServiceNodesWithOptions} endpoint; * however, this endpoint automatically returns the status of the associated health check as well as any system level health checks. * * @param service the service name * @param passing if true, filter results to only nodes with all checks in the passing state * @param options options used to request services * @param resultHandler will be provided with list of services * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/health.html#list-nodes-for-service">/v1/health/service/:service</a> endpoint */
@Fluent ConsulClient healthServiceNodesWithOptions(String service, boolean passing, ServiceQueryOptions options, Handler<AsyncResult<ServiceEntryList>> resultHandler); /** * Like {@link #healthServiceNodesWithOptions(String, boolean, ServiceQueryOptions, Handler)} but returns a {@code Future} of the asynchronous result. */ Future<ServiceEntryList> healthServiceNodesWithOptions(String service, boolean passing, ServiceQueryOptions options);
Returns the services registered in a datacenter
Params:
  • resultHandler – will be provided with list of services
See Also:
Returns:reference to this, for fluency
/** * Returns the services registered in a datacenter * * @param resultHandler will be provided with list of services * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/catalog.html#list-services">/v1/catalog/services</a> endpoint */
@Fluent ConsulClient catalogServices(Handler<AsyncResult<ServiceList>> resultHandler);
Like catalogServices(Handler<AsyncResult<ServiceList>>) but returns a Future of the asynchronous result.
/** * Like {@link #catalogServices(Handler)} but returns a {@code Future} of the asynchronous result. */
Future<ServiceList> catalogServices();
Returns the services registered in a datacenter This is blocking query unlike catalogServices(Handler<AsyncResult<ServiceList>>)
Params:
  • resultHandler – will be provided with list of services
  • options – the blocking options
See Also:
Returns:reference to this, for fluency
/** * Returns the services registered in a datacenter * This is blocking query unlike {@link ConsulClient#catalogServices(Handler)} * * @param resultHandler will be provided with list of services * @param options the blocking options * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/catalog.html#list-services">/v1/catalog/services</a> endpoint */
@Fluent ConsulClient catalogServicesWithOptions(BlockingQueryOptions options, Handler<AsyncResult<ServiceList>> resultHandler); /** * Like {@link #catalogServicesWithOptions(BlockingQueryOptions, Handler)} but returns a {@code Future} of the asynchronous result. */ Future<ServiceList> catalogServicesWithOptions(BlockingQueryOptions options);
Returns the node's registered services
Params:
  • node – node name
  • resultHandler – will be provided with list of services
See Also:
Returns:reference to this, for fluency
/** * Returns the node's registered services * * @param node node name * @param resultHandler will be provided with list of services * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/catalog.html#list-services-for-node">/v1/catalog/node/:node</a> endpoint */
@Fluent ConsulClient catalogNodeServices(String node, Handler<AsyncResult<ServiceList>> resultHandler);
Like catalogNodeServices(String, Handler<AsyncResult<ServiceList>>) but returns a Future of the asynchronous result.
/** * Like {@link #catalogNodeServices(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<ServiceList> catalogNodeServices(String node);
Returns the node's registered services This is blocking query unlike catalogNodeServices(String, Handler<AsyncResult<ServiceList>>)
Params:
  • node – node name
  • options – the blocking options
  • resultHandler – will be provided with list of services
See Also:
Returns:reference to this, for fluency
/** * Returns the node's registered services * This is blocking query unlike {@link ConsulClient#catalogNodeServices(String, Handler)} * * @param node node name * @param options the blocking options * @param resultHandler will be provided with list of services * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/catalog.html#list-services-for-node">/v1/catalog/node/:node</a> endpoint */
@Fluent ConsulClient catalogNodeServicesWithOptions(String node, BlockingQueryOptions options, Handler<AsyncResult<ServiceList>> resultHandler); /** * Like {@link #catalogNodeServicesWithOptions(String, BlockingQueryOptions, Handler)} but returns a {@code Future} of the asynchronous result. */ Future<ServiceList> catalogNodeServicesWithOptions(String node, BlockingQueryOptions options);
Returns list of services registered with the local agent.
Params:
  • resultHandler – will be provided with list of services
See Also:
Returns:reference to this, for fluency
/** * Returns list of services registered with the local agent. * * @param resultHandler will be provided with list of services * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/agent/service.html#list-services">/v1/agent/services</a> endpoint */
@Fluent ConsulClient localServices(Handler<AsyncResult<List<Service>>> resultHandler);
Like localServices(Handler<AsyncResult<List<Service>>>) but returns a Future of the asynchronous result.
/** * Like {@link #localServices(Handler)} but returns a {@code Future} of the asynchronous result. */
Future<List<Service>> localServices();
Return all the checks that are registered with the local agent.
Params:
  • resultHandler – will be provided with list of checks
See Also:
Returns:reference to this, for fluency
/** * Return all the checks that are registered with the local agent. * * @param resultHandler will be provided with list of checks * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/agent/check.html#list-checks">/v1/agent/checks</a> endpoint */
@Fluent ConsulClient localChecks(Handler<AsyncResult<List<Check>>> resultHandler);
Like localChecks(Handler<AsyncResult<List<Check>>>) but returns a Future of the asynchronous result.
/** * Like {@link #localChecks(Handler)} but returns a {@code Future} of the asynchronous result. */
Future<List<Check>> localChecks();
Add a new check to the local agent. The agent is responsible for managing the status of the check and keeping the Catalog in sync.
Params:
  • checkOptions – options used to register new check
  • resultHandler – will be called when complete
See Also:
Returns:reference to this, for fluency
/** * Add a new check to the local agent. The agent is responsible for managing the status of the check * and keeping the Catalog in sync. * * @param checkOptions options used to register new check * @param resultHandler will be called when complete * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/agent/check.html#register-check">/v1/agent/check/register</a> endpoint */
@Fluent ConsulClient registerCheck(CheckOptions checkOptions, Handler<AsyncResult<Void>> resultHandler);
Like registerCheck(CheckOptions, Handler<AsyncResult<Void>>) but returns a Future of the asynchronous result.
/** * Like {@link #registerCheck(CheckOptions, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Void> registerCheck(CheckOptions checkOptions);
Remove a check from the local agent. The agent will take care of deregistering the check from the Catalog.
Params:
  • checkId – the ID of check
  • resultHandler – will be called when complete
See Also:
Returns:reference to this, for fluency
/** * Remove a check from the local agent. The agent will take care of deregistering the check from the Catalog. * * @param checkId the ID of check * @param resultHandler will be called when complete * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/agent/check.html#deregister-check">/v1/agent/check/deregister/:check_id</a> endpoint */
@Fluent ConsulClient deregisterCheck(String checkId, Handler<AsyncResult<Void>> resultHandler);
Like deregisterCheck(String, Handler<AsyncResult<Void>>) but returns a Future of the asynchronous result.
/** * Like {@link #deregisterCheck(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Void> deregisterCheck(String checkId);
Set status of the check to "passing". Used with a check that is of the TTL type. The TTL clock will be reset.
Params:
  • checkId – the ID of check
  • resultHandler – will be called when complete
See Also:
Returns:reference to this, for fluency
/** * Set status of the check to "passing". Used with a check that is of the TTL type. The TTL clock will be reset. * * @param checkId the ID of check * @param resultHandler will be called when complete * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/agent/check.html#ttl-check-pass">/v1/agent/check/pass/:check_id</a> endpoint * @see CheckStatus */
@Fluent ConsulClient passCheck(String checkId, Handler<AsyncResult<Void>> resultHandler);
Like passCheck(String, Handler<AsyncResult<Void>>) but returns a Future of the asynchronous result.
/** * Like {@link #passCheck(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Void> passCheck(String checkId);
Set status of the check to "passing". Used with a check that is of the TTL type. The TTL clock will be reset.
Params:
  • checkId – the ID of check
  • note – specifies a human-readable message. This will be passed through to the check's Output field.
  • resultHandler – will be called when complete
See Also:
Returns:reference to this, for fluency
/** * Set status of the check to "passing". Used with a check that is of the TTL type. The TTL clock will be reset. * * @param checkId the ID of check * @param note specifies a human-readable message. This will be passed through to the check's {@code Output} field. * @param resultHandler will be called when complete * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/agent/check.html#ttl-check-pass">/v1/agent/check/pass/:check_id</a> endpoint * @see CheckStatus */
@Fluent ConsulClient passCheckWithNote(String checkId, String note, Handler<AsyncResult<Void>> resultHandler);
Like passCheckWithNote(String, String, Handler<AsyncResult<Void>>) but returns a Future of the asynchronous result.
/** * Like {@link #passCheckWithNote(String, String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Void> passCheckWithNote(String checkId, String note);
Set status of the check to "warning". Used with a check that is of the TTL type. The TTL clock will be reset.
Params:
  • checkId – the ID of check
  • resultHandler – will be called when complete
See Also:
Returns:reference to this, for fluency
/** * Set status of the check to "warning". Used with a check that is of the TTL type. The TTL clock will be reset. * * @param checkId the ID of check * @param resultHandler will be called when complete * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/agent/check.html#ttl-check-warn">/v1/agent/check/warn/:check_id</a> endpoint * @see CheckStatus */
@Fluent ConsulClient warnCheck(String checkId, Handler<AsyncResult<Void>> resultHandler);
Like warnCheck(String, Handler<AsyncResult<Void>>) but returns a Future of the asynchronous result.
/** * Like {@link #warnCheck(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Void> warnCheck(String checkId);
Set status of the check to "warning". Used with a check that is of the TTL type. The TTL clock will be reset.
Params:
  • checkId – the ID of check
  • note – specifies a human-readable message. This will be passed through to the check's Output field.
  • resultHandler – will be called when complete
See Also:
Returns:reference to this, for fluency
/** * Set status of the check to "warning". Used with a check that is of the TTL type. The TTL clock will be reset. * * @param checkId the ID of check * @param note specifies a human-readable message. This will be passed through to the check's {@code Output} field. * @param resultHandler will be called when complete * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/agent/check.html#ttl-check-warn">/v1/agent/check/warn/:check_id</a> endpoint * @see CheckStatus */
@Fluent ConsulClient warnCheckWithNote(String checkId, String note, Handler<AsyncResult<Void>> resultHandler);
Like warnCheckWithNote(String, String, Handler<AsyncResult<Void>>) but returns a Future of the asynchronous result.
/** * Like {@link #warnCheckWithNote(String, String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Void> warnCheckWithNote(String checkId, String note);
Set status of the check to "critical". Used with a check that is of the TTL type. The TTL clock will be reset.
Params:
  • checkId – the ID of check
  • resultHandler – will be called when complete
See Also:
Returns:reference to this, for fluency
/** * Set status of the check to "critical". Used with a check that is of the TTL type. The TTL clock will be reset. * * @param checkId the ID of check * @param resultHandler will be called when complete * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/agent/check.html#ttl-check-fail">/v1/agent/check/fail/:check_id</a> endpoint * @see CheckStatus */
@Fluent ConsulClient failCheck(String checkId, Handler<AsyncResult<Void>> resultHandler);
Like failCheck(String, Handler<AsyncResult<Void>>) but returns a Future of the asynchronous result.
/** * Like {@link #failCheck(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Void> failCheck(String checkId);
Set status of the check to "critical". Used with a check that is of the TTL type. The TTL clock will be reset.
Params:
  • checkId – the ID of check
  • note – specifies a human-readable message. This will be passed through to the check's Output field.
  • resultHandler – will be called when complete
See Also:
Returns:reference to this, for fluency
/** * Set status of the check to "critical". Used with a check that is of the TTL type. The TTL clock will be reset. * * @param checkId the ID of check * @param note specifies a human-readable message. This will be passed through to the check's {@code Output} field. * @param resultHandler will be called when complete * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/agent/check.html#ttl-check-fail">/v1/agent/check/fail/:check_id</a> endpoint * @see CheckStatus */
@Fluent ConsulClient failCheckWithNote(String checkId, String note, Handler<AsyncResult<Void>> resultHandler);
Like failCheckWithNote(String, String, Handler<AsyncResult<Void>>) but returns a Future of the asynchronous result.
/** * Like {@link #failCheckWithNote(String, String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Void> failCheckWithNote(String checkId, String note);
Set status of the check to given status. Used with a check that is of the TTL type. The TTL clock will be reset.
Params:
  • checkId – the ID of check
  • status – new status of check
  • resultHandler – will be called when complete
See Also:
Returns:reference to this, for fluency
/** * Set status of the check to given status. Used with a check that is of the TTL type. The TTL clock will be reset. * * @param checkId the ID of check * @param status new status of check * @param resultHandler will be called when complete * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/agent/check.html#ttl-check-update">/v1/agent/check/update/:check_id</a> endpoint */
@Fluent ConsulClient updateCheck(String checkId, CheckStatus status, Handler<AsyncResult<Void>> resultHandler);
Like updateCheck(String, CheckStatus, Handler<AsyncResult<Void>>) but returns a Future of the asynchronous result.
/** * Like {@link #updateCheck(String, CheckStatus, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Void> updateCheck(String checkId, CheckStatus status);
Set status of the check to given status. Used with a check that is of the TTL type. The TTL clock will be reset.
Params:
  • checkId – the ID of check
  • status – new status of check
  • note – specifies a human-readable message. This will be passed through to the check's Output field.
  • resultHandler – will be called when complete
See Also:
Returns:reference to this, for fluency
/** * Set status of the check to given status. Used with a check that is of the TTL type. The TTL clock will be reset. * * @param checkId the ID of check * @param status new status of check * @param note specifies a human-readable message. This will be passed through to the check's {@code Output} field. * @param resultHandler will be called when complete * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/agent/check.html#ttl-check-update">/v1/agent/check/update/:check_id</a> endpoint */
@Fluent ConsulClient updateCheckWithNote(String checkId, CheckStatus status, String note, Handler<AsyncResult<Void>> resultHandler);
Like updateCheckWithNote(String, CheckStatus, String, Handler<AsyncResult<Void>>) but returns a Future of the asynchronous result.
/** * Like {@link #updateCheckWithNote(String, CheckStatus, String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Void> updateCheckWithNote(String checkId, CheckStatus status, String note);
Get the Raft leader for the datacenter in which the agent is running. It returns an address in format "10.1.10.12:8300"
Params:
  • resultHandler – will be provided with address of cluster leader
See Also:
Returns:reference to this, for fluency
/** * Get the Raft leader for the datacenter in which the agent is running. * It returns an address in format "<code>10.1.10.12:8300</code>" * * @param resultHandler will be provided with address of cluster leader * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/status.html#get-raft-leader">/v1/status/leader</a> endpoint */
@Fluent ConsulClient leaderStatus(Handler<AsyncResult<String>> resultHandler);
Like leaderStatus(Handler<AsyncResult<String>>) but returns a Future of the asynchronous result.
Returns:
/** * Like {@link #leaderStatus(Handler)} but returns a {@code Future} of the asynchronous result. * * @return */
Future<String> leaderStatus();
Retrieves the Raft peers for the datacenter in which the the agent is running. It returns a list of addresses "10.1.10.12:8300", "10.1.10.13:8300"
Params:
  • resultHandler – will be provided with list of peers
See Also:
Returns:reference to this, for fluency
/** * Retrieves the Raft peers for the datacenter in which the the agent is running. * It returns a list of addresses "<code>10.1.10.12:8300</code>", "<code>10.1.10.13:8300</code>" * * @param resultHandler will be provided with list of peers * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/status.html#list-raft-peers">/v1/status/peers</a> endpoint */
@Fluent ConsulClient peersStatus(Handler<AsyncResult<List<String>>> resultHandler);
Like peersStatus(Handler<AsyncResult<List<String>>>) but returns a Future of the asynchronous result.
/** * Like {@link #peersStatus(Handler)} but returns a {@code Future} of the asynchronous result. */
Future<List<String>> peersStatus();
Initialize a new session
Params:
  • idHandler – will be provided with ID of new session
See Also:
Returns:reference to this, for fluency
/** * Initialize a new session * * @param idHandler will be provided with ID of new session * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/session.html#create-session">/v1/session/create</a> endpoint */
@Fluent ConsulClient createSession(Handler<AsyncResult<String>> idHandler);
Like createSession(Handler<AsyncResult<String>>) but returns a Future of the asynchronous result.
/** * Like {@link #createSession(Handler)} but returns a {@code Future} of the asynchronous result. */
Future<String> createSession();
Initialize a new session
Params:
  • options – options used to create session
  • idHandler – will be provided with ID of new session
See Also:
Returns:reference to this, for fluency
/** * Initialize a new session * * @param options options used to create session * @param idHandler will be provided with ID of new session * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/session.html#create-session">/v1/session/create</a> endpoint */
@Fluent ConsulClient createSessionWithOptions(SessionOptions options, Handler<AsyncResult<String>> idHandler);
Like createSessionWithOptions(SessionOptions, Handler<AsyncResult<String>>) but returns a Future of the asynchronous result.
/** * Like {@link #createSessionWithOptions(SessionOptions, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<String> createSessionWithOptions(SessionOptions options);
Returns the requested session information
Params:
  • id – the ID of requested session
  • resultHandler – will be provided with info of requested session
See Also:
Returns:reference to this, for fluency
/** * Returns the requested session information * * @param id the ID of requested session * @param resultHandler will be provided with info of requested session * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/session.html#read-session">/v1/session/info/:uuid</a> endpoint */
@Fluent ConsulClient infoSession(String id, Handler<AsyncResult<Session>> resultHandler);
Like infoSession(String, Handler<AsyncResult<Session>>) but returns a Future of the asynchronous result.
/** * Like {@link #infoSession(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Session> infoSession(String id);
Returns the requested session information This is blocking query unlike infoSession(String, Handler<AsyncResult<Session>>)
Params:
  • id – the ID of requested session
  • options – the blocking options
  • resultHandler – will be provided with info of requested session
See Also:
Returns:reference to this, for fluency
/** * Returns the requested session information * This is blocking query unlike {@link ConsulClient#infoSession(String, Handler)} * * @param id the ID of requested session * @param options the blocking options * @param resultHandler will be provided with info of requested session * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/session.html#read-session">/v1/session/info/:uuid</a> endpoint */
@Fluent ConsulClient infoSessionWithOptions(String id, BlockingQueryOptions options, Handler<AsyncResult<Session>> resultHandler); /** * Like {@link #infoSessionWithOptions(String, BlockingQueryOptions, Handler)} but returns a {@code Future} of the asynchronous result. */ Future<Session> infoSessionWithOptions(String id, BlockingQueryOptions options);
Renews the given session. This is used with sessions that have a TTL, and it extends the expiration by the TTL
Params:
  • id – the ID of session that should be renewed
  • resultHandler – will be provided with info of renewed session
See Also:
Returns:reference to this, for fluency
/** * Renews the given session. This is used with sessions that have a TTL, and it extends the expiration by the TTL * * @param id the ID of session that should be renewed * @param resultHandler will be provided with info of renewed session * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/session.html#renew-session">/v1/session/renew/:uuid</a> endpoint */
@Fluent ConsulClient renewSession(String id, Handler<AsyncResult<Session>> resultHandler);
Like renewSession(String, Handler<AsyncResult<Session>>) but returns a Future of the asynchronous result.
/** * Like {@link #renewSession(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Session> renewSession(String id);
Returns the active sessions
Params:
  • resultHandler – will be provided with list of sessions
See Also:
Returns:reference to this, for fluency
/** * Returns the active sessions * * @param resultHandler will be provided with list of sessions * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/session.html#list-sessions">/v1/session/list</a> endpoint */
@Fluent ConsulClient listSessions(Handler<AsyncResult<SessionList>> resultHandler);
Like listSessions(Handler<AsyncResult<SessionList>>) but returns a Future of the asynchronous result.
/** * Like {@link #listSessions(Handler)} but returns a {@code Future} of the asynchronous result. */
Future<SessionList> listSessions();
Returns the active sessions This is blocking query unlike listSessions(Handler<AsyncResult<SessionList>>)
Params:
  • options – the blocking options
  • resultHandler – will be provided with list of sessions
See Also:
Returns:reference to this, for fluency
/** * Returns the active sessions * This is blocking query unlike {@link ConsulClient#listSessions(Handler)} * * @param options the blocking options * @param resultHandler will be provided with list of sessions * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/session.html#list-sessions">/v1/session/list</a> endpoint */
@Fluent ConsulClient listSessionsWithOptions(BlockingQueryOptions options, Handler<AsyncResult<SessionList>> resultHandler);
Like listSessionsWithOptions(BlockingQueryOptions, Handler<AsyncResult<SessionList>>) but returns a Future of the asynchronous result.
/** * Like {@link #listSessionsWithOptions(BlockingQueryOptions, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<SessionList> listSessionsWithOptions(BlockingQueryOptions options);
Returns the active sessions for a given node
Params:
  • nodeId – the ID of node
  • resultHandler – will be provided with list of sessions
See Also:
Returns:reference to this, for fluency
/** * Returns the active sessions for a given node * * @param nodeId the ID of node * @param resultHandler will be provided with list of sessions * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/session.html#list-sessions-for-node">/v1/session/node/:node</a> endpoint */
@Fluent ConsulClient listNodeSessions(String nodeId, Handler<AsyncResult<SessionList>> resultHandler);
Like listNodeSessions(String, Handler<AsyncResult<SessionList>>) but returns a Future of the asynchronous result.
/** * Like {@link #listNodeSessions(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<SessionList> listNodeSessions(String nodeId);
Returns the active sessions for a given node This is blocking query unlike listNodeSessions(String, Handler<AsyncResult<SessionList>>)
Params:
  • nodeId – the ID of node
  • options – the blocking options
  • resultHandler – will be provided with list of sessions
See Also:
Returns:reference to this, for fluency
/** * Returns the active sessions for a given node * This is blocking query unlike {@link ConsulClient#listNodeSessions(String, Handler)} * * @param nodeId the ID of node * @param options the blocking options * @param resultHandler will be provided with list of sessions * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/session.html#list-sessions-for-node">/v1/session/node/:node</a> endpoint */
@Fluent ConsulClient listNodeSessionsWithOptions(String nodeId, BlockingQueryOptions options, Handler<AsyncResult<SessionList>> resultHandler); /** * Like {@link #listNodeSessionsWithOptions(String, BlockingQueryOptions, Handler)} but returns a {@code Future} of the asynchronous result. */ Future<SessionList> listNodeSessionsWithOptions(String nodeId, BlockingQueryOptions options);
Destroys the given session
Params:
  • id – the ID of session
  • resultHandler – will be called when complete
See Also:
Returns:reference to this, for fluency
/** * Destroys the given session * * @param id the ID of session * @param resultHandler will be called when complete * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/session.html#delete-session">/v1/session/destroy/:uuid</a> endpoint */
@Fluent ConsulClient destroySession(String id, Handler<AsyncResult<Void>> resultHandler);
Like destroySession(String, Handler<AsyncResult<Void>>) but returns a Future of the asynchronous result.
/** * Like {@link #destroySession(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Void> destroySession(String id);
Params:
  • definition – definition of the prepare query
  • resultHandler – will be provided with id of created prepare query
See Also:
Returns:reference to this, for fluency
/** * @param definition definition of the prepare query * @param resultHandler will be provided with id of created prepare query * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/query.html#create-prepared-query">/v1/query</a> endpoint */
@Fluent ConsulClient createPreparedQuery(PreparedQueryDefinition definition, Handler<AsyncResult<String>> resultHandler);
Like createPreparedQuery(PreparedQueryDefinition, Handler<AsyncResult<String>>) but returns a Future of the asynchronous result.
/** * Like {@link #createPreparedQuery(PreparedQueryDefinition, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<String> createPreparedQuery(PreparedQueryDefinition definition);
Returns an existing prepared query
Params:
  • id – the id of the query to read
  • resultHandler – will be provided with definition of the prepare query
See Also:
Returns:reference to this, for fluency
/** * Returns an existing prepared query * * @param id the id of the query to read * @param resultHandler will be provided with definition of the prepare query * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/query.html#read-prepared-query-1">/v1/query/:uuid</a> endpoint */
@Fluent ConsulClient getPreparedQuery(String id, Handler<AsyncResult<PreparedQueryDefinition>> resultHandler);
Like getPreparedQuery(String, Handler<AsyncResult<PreparedQueryDefinition>>) but returns a Future of the asynchronous result.
/** * Like {@link #getPreparedQuery(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<PreparedQueryDefinition> getPreparedQuery(String id);
Returns a list of all prepared queries.
Params:
  • resultHandler – will be provided with list of definitions of the all prepare queries
See Also:
Returns:reference to this, for fluency
/** * Returns a list of all prepared queries. * * @param resultHandler will be provided with list of definitions of the all prepare queries * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/query.html#read-prepared-query">/v1/query</a> endpoint */
@Fluent ConsulClient getAllPreparedQueries(Handler<AsyncResult<List<PreparedQueryDefinition>>> resultHandler);
Like getAllPreparedQueries(Handler<AsyncResult<List<PreparedQueryDefinition>>>) but returns a Future of the asynchronous result.
/** * Like {@link #getAllPreparedQueries(Handler)} but returns a {@code Future} of the asynchronous result. */
Future<List<PreparedQueryDefinition>> getAllPreparedQueries();
Params:
  • definition – definition of the prepare query
  • resultHandler – will be called when complete
See Also:
Returns:reference to this, for fluency
/** * @param definition definition of the prepare query * @param resultHandler will be called when complete * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/query.html#update-prepared-query">/v1/query/:uuid</a> endpoint */
@Fluent ConsulClient updatePreparedQuery(PreparedQueryDefinition definition, Handler<AsyncResult<Void>> resultHandler);
Like updatePreparedQuery(PreparedQueryDefinition, Handler<AsyncResult<Void>>) but returns a Future of the asynchronous result.
/** * Like {@link #updatePreparedQuery(PreparedQueryDefinition, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Void> updatePreparedQuery(PreparedQueryDefinition definition);
Deletes an existing prepared query
Params:
  • id – the id of the query to delete
  • resultHandler – will be called when complete
See Also:
Returns:reference to this, for fluency
/** * Deletes an existing prepared query * * @param id the id of the query to delete * @param resultHandler will be called when complete * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/query.html#delete-prepared-query">/v1/query/:uuid</a> endpoint */
@Fluent ConsulClient deletePreparedQuery(String id, Handler<AsyncResult<Void>> resultHandler);
Like deletePreparedQuery(String, Handler<AsyncResult<Void>>) but returns a Future of the asynchronous result.
/** * Like {@link #deletePreparedQuery(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<Void> deletePreparedQuery(String id);
Executes an existing prepared query.
Params:
  • query – the ID of the query to execute. This can also be the name of an existing prepared query, or a name that matches a prefix name for a prepared query template.
  • resultHandler – will be provided with response
See Also:
Returns:reference to this, for fluency
/** * Executes an existing prepared query. * * @param query the ID of the query to execute. This can also be the name of an existing prepared query, * or a name that matches a prefix name for a prepared query template. * @param resultHandler will be provided with response * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/query.html#execute-prepared-query">/v1/query/:uuid/execute</a> endpoint */
@Fluent ConsulClient executePreparedQuery(String query, Handler<AsyncResult<PreparedQueryExecuteResponse>> resultHandler);
Like executePreparedQuery(String, Handler<AsyncResult<PreparedQueryExecuteResponse>>) but returns a Future of the asynchronous result.
/** * Like {@link #executePreparedQuery(String, Handler)} but returns a {@code Future} of the asynchronous result. */
Future<PreparedQueryExecuteResponse> executePreparedQuery(String query);
Executes an existing prepared query.
Params:
  • query – the ID of the query to execute. This can also be the name of an existing prepared query, or a name that matches a prefix name for a prepared query template.
  • options – the options used to execute prepared query
  • resultHandler – will be provided with response
See Also:
Returns:reference to this, for fluency
/** * Executes an existing prepared query. * * @param query the ID of the query to execute. This can also be the name of an existing prepared query, * or a name that matches a prefix name for a prepared query template. * @param options the options used to execute prepared query * @param resultHandler will be provided with response * @return reference to this, for fluency * @see <a href="https://www.consul.io/api/query.html#execute-prepared-query">/v1/query/:uuid/execute</a> endpoint */
@Fluent ConsulClient executePreparedQueryWithOptions(String query, PreparedQueryExecuteOptions options, Handler<AsyncResult<PreparedQueryExecuteResponse>> resultHandler); /** * Like {@link #executePreparedQueryWithOptions(String, PreparedQueryExecuteOptions, Handler)} but returns a {@code Future} of the asynchronous result. */ Future<PreparedQueryExecuteResponse> executePreparedQueryWithOptions(String query, PreparedQueryExecuteOptions options);
Close the client and release its resources
/** * Close the client and release its resources */
void close(); }