Class NodeEntry

java.lang.Object
io.micronaut.discovery.consul.client.v1.NodeEntry

public class NodeEntry extends Object
Since:
1.0
Author:
graemerocher
  • Constructor Details

    • NodeEntry

      public NodeEntry(String nodeId, String hostString)
      Create a new catalog entry.
      Parameters:
      nodeId - The node ID
      hostString - The node address as sent by Consul, a host name or an IP literal
      Since:
      5.2.0
    • NodeEntry

      @Deprecated(since="5.2.0", forRemoval=true) public NodeEntry(String nodeId, InetAddress address)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Create a new catalog entry. The address is stored as its host name, or as its IP literal when it has no host name.
      Parameters:
      nodeId - The node ID
      address - The node address
  • Method Details

    • getTaggedAddresses

      public Map<String,String> getTaggedAddresses()
      See https://www.consul.io/api/catalog.html#taggedaddresses.
      Returns:
      The tagged addresses
    • setTaggedAddresses

      public void setTaggedAddresses(Map<String,String> taggedAddresses)
      See https://www.consul.io/api/catalog.html#taggedaddresses.
      Parameters:
      taggedAddresses - The tagged addresses
    • getNodeMetadata

      public Map<String,String> getNodeMetadata()
      See https://www.consul.io/api/catalog.html#nodemeta.
      Returns:
      The node metadata
    • nodeMetadata

      public NodeEntry nodeMetadata(Map<String,String> nodeMetadata)
      Parameters:
      nodeMetadata - The node metadata
      Returns:
      The NodeEntry instance
    • setNodeMetadata

      public void setNodeMetadata(Map<String,String> nodeMetadata)
      See https://www.consul.io/api/catalog.html#nodemeta.
      Parameters:
      nodeMetadata - The node metadata
    • getNode

      public String getNode()
      See https://www.consul.io/api/catalog.html#node.
      Returns:
      The node ID
    • getHostString

      public String getHostString()
      See https://www.consul.io/api/catalog.html#address.
      Returns:
      The node address as sent by Consul, a host name or an IP literal. It is not resolved.
      Since:
      5.2.0
    • getAddress

      @Deprecated(since="5.2.0", forRemoval=true) public InetAddress getAddress()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use getHostString() and resolve the address where it is needed.
      See https://www.consul.io/api/catalog.html#address.

      The address is resolved on each call, which needs a DNS lookup when Consul sent a host name.

      Returns:
      The resolved node address, or null if there is none
      Throws:
      UncheckedIOException - if the host name cannot be resolved
    • getDatacenter

      public Optional<String> getDatacenter()
      See https://www.consul.io/api/catalog.html#datacenter.
      Returns:
      The data center to use
    • setDatacenter

      public void setDatacenter(String datacenter)
      See https://www.consul.io/api/catalog.html#datacenter.
      Parameters:
      datacenter - The data center to use
    • datacenter

      public NodeEntry datacenter(String datacenter)
      Parameters:
      datacenter - The datacenter
      Returns:
      The NodeEntry instance
    • taggedAddresses

      public NodeEntry taggedAddresses(Map<String,String> taggedAddresses)
      Parameters:
      taggedAddresses - The tagged addresses
      Returns:
      The NodeEntry instance