Class CatalogClient


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

      • http

        protected final Http http
    • Method Detail

      • getDatacenters

        public java.util.List<java.lang.String> getDatacenters()
        Retrieves all datacenters.

        GET /v1/catalog/datacenters

        Returns:
        A list of datacenter names.
      • getDatacenters

        public java.util.List<java.lang.String> getDatacenters​(QueryOptions queryOptions)
        Get the list of datacenters with query options
        Parameters:
        queryOptions -
        Returns:
      • getNodes

        public ConsulResponse<java.util.List<Node>> getNodes​(QueryOptions queryOptions)
        Retrieves all nodes for a given datacenter with QueryOptions.

        GET /v1/catalog/nodes?dc={datacenter}

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

        public void getNodes​(QueryOptions queryOptions,
                             ConsulResponseCallback<java.util.List<Node>> callback)
        Asynchronously retrieves the nodes for a given datacenter with QueryOptions.

        GET /v1/catalog/nodes?dc={datacenter}

        Parameters:
        queryOptions - The Query Options to use.
        callback - Callback implemented by callee to handle results. Node objects.
      • getServices

        public ConsulResponse<java.util.Map<java.lang.String,​java.util.List<java.lang.String>>> getServices()
        Retrieves all services for a given datacenter.

        GET /v1/catalog/services?dc={datacenter}

        Returns:
        A ConsulResponse containing a map of service name to list of tags.
      • getServices

        public void getServices​(ConsulResponseCallback<java.util.Map<java.lang.String,​java.util.List<java.lang.String>>> callback)
        Asynchronously retrieves the services for a given datacenter.

        GET /v1/catalog/services?dc={datacenter}

        Parameters:
        callback - Callback implemented by callee to handle results.
      • getServices

        public ConsulResponse<java.util.Map<java.lang.String,​java.util.List<java.lang.String>>> getServices​(QueryOptions queryOptions)
        Retrieves all services for a given datacenter.

        GET /v1/catalog/services?dc={datacenter}

        Parameters:
        queryOptions - The Query Options to use.
        Returns:
        A ConsulResponse containing a map of service name to list of tags.
      • getServices

        public void getServices​(QueryOptions queryOptions,
                                ConsulResponseCallback<java.util.Map<java.lang.String,​java.util.List<java.lang.String>>> callback)
        Asynchronously retrieves the services for a given datacenter.

        GET /v1/catalog/services?dc={datacenter}

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

        public void getService​(java.lang.String service,
                               QueryOptions queryOptions,
                               ConsulResponseCallback<java.util.List<CatalogService>> callback)
        Asynchronously retrieves the single service for a given datacenter with QueryOptions.

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

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

        public ConsulResponse<CatalogNode> getNode​(java.lang.String node,
                                                   QueryOptions queryOptions)
        Retrieves a single node for a given datacenter with QueryOptions.

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

        Parameters:
        queryOptions - The Query Options to use.
        Returns:
        A list of matching CatalogService objects.
      • getNode

        public void getNode​(java.lang.String node,
                            QueryOptions queryOptions,
                            ConsulResponseCallback<CatalogNode> callback)
        Asynchronously retrieves the single node for a given datacenter with QueryOptions.

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

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