Class HealthClient

java.lang.Object
org.kiwiproject.consul.HealthClient

public class HealthClient extends Object
HTTP Client for /v1/health/ endpoints.
  • Field Details

    • http

      protected final Http http
  • Method Details

    • getNodeChecks

      public ConsulResponse<List<HealthCheck>> getNodeChecks(String node)
      Retrieves the healthchecks for a node.

      GET /v1/health/node/{node}

      Parameters:
      node - The node to return checks for
      Returns:
      A ConsulResponse containing a list of HealthCheck objects.
    • getNodeChecks

      public ConsulResponse<List<HealthCheck>> getNodeChecks(String node, QueryOptions queryOptions)
      Retrieves the healthchecks for a node in a given datacenter with QueryOptions.

      GET /v1/health/node/{node}?dc={datacenter}

      Parameters:
      node - The node to return checks for
      queryOptions - The Query Options to use.
      Returns:
      A ConsulResponse containing a list of HealthCheck objects.
    • getServiceChecks

      public ConsulResponse<List<HealthCheck>> getServiceChecks(String service)
      Retrieves the healthchecks for a service.

      GET /v1/health/checks/{service}

      Parameters:
      service - the name of the service to get health checks for
      Returns:
      A ConsulResponse containing a list of HealthCheck objects.
    • getServiceChecks

      public ConsulResponse<List<HealthCheck>> getServiceChecks(String service, QueryOptions queryOptions)
      Retrieves the healthchecks for a service in a given datacenter with QueryOptions.

      GET /v1/health/checks/{service}?dc={datacenter}

      Parameters:
      service - the name of the service to get health checks for
      queryOptions - The Query Options to use.
      Returns:
      A ConsulResponse containing a list of HealthCheck objects.
    • getServiceChecks

      public void getServiceChecks(String service, QueryOptions queryOptions, ConsulResponseCallback<List<HealthCheck>> callback)
      Asynchronously retrieves the healthchecks for a service in a given datacenter with QueryOptions.

      GET /v1/health/checks/{service}?dc={datacenter}

      Parameters:
      service - The service to query.
      queryOptions - The Query Options to use.
      callback - Callback implemented by callee to handle results. HealthCheck objects.
    • getChecksByState

      public ConsulResponse<List<HealthCheck>> getChecksByState(State state)
      Retrieves the healthchecks for a state.

      GET /v1/health/state/{state}

      Parameters:
      state - The state to query.
      Returns:
      A ConsulResponse containing a list of HealthCheck objects.
    • getChecksByState

      public ConsulResponse<List<HealthCheck>> getChecksByState(State state, QueryOptions queryOptions)
      Retrieves the healthchecks for a state in a given datacenter with QueryOptions.

      GET /v1/health/state/{state}?dc={datacenter}

      Parameters:
      state - The state to query.
      queryOptions - The Query Options to use.
      Returns:
      A ConsulResponse containing a list of HealthCheck objects.
    • getChecksByState

      public void getChecksByState(State state, QueryOptions queryOptions, ConsulResponseCallback<List<HealthCheck>> callback)
      Asynchronously retrieves the healthchecks for a state in a given datacenter with QueryOptions.

      GET /v1/health/state/{state}?dc={datacenter}

      Parameters:
      state - The state to query.
      queryOptions - The Query Options to use.
      callback - Callback implemented by callee to handle results, containing a list of HealthCheck objects.
    • getHealthyServiceInstances

      public ConsulResponse<List<ServiceHealth>> getHealthyServiceInstances(String service)
      Retrieves the healthchecks for all healthy service instances.

      GET /v1/health/service/{service}?passing

      Parameters:
      service - The service to query.
      Returns:
      A ConsulResponse containing a list of HealthCheck objects.
    • getHealthyServiceInstances

      public ConsulResponse<List<ServiceHealth>> getHealthyServiceInstances(String service, QueryOptions queryOptions)
      Retrieves the healthchecks for all healthy service instances in a given datacenter with QueryOptions.

      GET /v1/health/service/{service}?dc={datacenter}&passing

      Parameters:
      service - The service to query.
      queryOptions - The Query Options to use.
      Returns:
      A ConsulResponse containing a list of HealthCheck objects.
    • getHealthyServiceInstances

      public void getHealthyServiceInstances(String service, QueryOptions queryOptions, ConsulResponseCallback<List<ServiceHealth>> callback)
      Asynchronously retrieves the healthchecks for all healthy service instances in a given datacenter with QueryOptions.

      GET /v1/health/service/{service}?dc={datacenter}&passing

      Experimental.

      Parameters:
      service - The service to query.
      queryOptions - The Query Options to use.
      callback - Callback implemented by callee to handle results.
    • getAllServiceInstances

      public ConsulResponse<List<ServiceHealth>> getAllServiceInstances(String service)
      Retrieves the healthchecks for all nodes.

      GET /v1/health/service/{service}

      Parameters:
      service - The service to query.
      Returns:
      A ConsulResponse containing a list of HealthCheck objects.
    • getAllServiceInstances

      public ConsulResponse<List<ServiceHealth>> getAllServiceInstances(String service, QueryOptions queryOptions)
      Retrieves the healthchecks for all nodes in a given datacenter with QueryOptions.

      GET /v1/health/service/{service}?dc={datacenter}

      Parameters:
      service - The service to query.
      queryOptions - The Query Options to use.
      Returns:
      A ConsulResponse containing a list of HealthCheck objects.
    • getAllServiceInstances

      public void getAllServiceInstances(String service, QueryOptions queryOptions, ConsulResponseCallback<List<ServiceHealth>> callback)
      Asynchronously retrieves the healthchecks for all nodes in a given datacenter with QueryOptions.

      GET /v1/health/service/{service}?dc={datacenter}

      Experimental.

      Parameters:
      service - The service to query.
      queryOptions - The Query Options to use.
      callback - Callback implemented by callee to handle results.
    • getNetworkTimeoutConfig

      public Consul.NetworkTimeoutConfig getNetworkTimeoutConfig()
    • getConfig

      public ClientConfig getConfig()
    • getEventHandler

      public ClientEventHandler getEventHandler()