Class HealthClient


  • public class HealthClient
    extends java.lang.Object
    HTTP Client for /v1/health/ endpoints.
    • Field Detail

      • http

        protected final Http http
    • Method Detail

      • getNodeChecks

        public ConsulResponse<java.util.List<HealthCheck>> getNodeChecks​(java.lang.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<java.util.List<HealthCheck>> getNodeChecks​(java.lang.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<java.util.List<HealthCheck>> getServiceChecks​(java.lang.String service)
        Retrieves the healthchecks for a service.

        GET /v1/health/checks/{service}

        Returns:
        A ConsulResponse containing a list of HealthCheck objects.
      • getServiceChecks

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

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

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

        public void getServiceChecks​(java.lang.String service,
                                     QueryOptions queryOptions,
                                     ConsulResponseCallback<java.util.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<java.util.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<java.util.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<java.util.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.
      • getHealthyServiceInstances

        public ConsulResponse<java.util.List<ServiceHealth>> getHealthyServiceInstances​(java.lang.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<java.util.List<ServiceHealth>> getHealthyServiceInstances​(java.lang.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​(java.lang.String service,
                                               QueryOptions queryOptions,
                                               ConsulResponseCallback<java.util.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<java.util.List<ServiceHealth>> getAllServiceInstances​(java.lang.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<java.util.List<ServiceHealth>> getAllServiceInstances​(java.lang.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​(java.lang.String service,
                                           QueryOptions queryOptions,
                                           ConsulResponseCallback<java.util.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.