Interface DarkHost


  • public interface DarkHost
    A host that does not have requests forwarded to it.

    Putting a host in dark mode is useful when needing to take a host out of an environment temporarily, e.g. for patching etc.

    • Method Detail

      • address

        InetAddress address()
        Returns:
        The address of the host
      • dateEnabled

        Instant dateEnabled()
        Returns:
        Returns the time that dark mode was turned on for this host
      • reason

        String reason()
        An optional description of why this host is in dark mode.
        Returns:
        A human-readable string, or null.
      • create

        static DarkHost create​(InetAddress address,
                               Instant dateEnabled,
                               String reason)
        Creates a new dark host
        Parameters:
        address - The address of the host, for example InetAddress.getByName("127.0.0.1")
        dateEnabled - The date it was disabled
        reason - An optional reason of why this was enabled
        Returns:
        A new DarkHost object
      • sameHost

        boolean sameHost​(InetAddress address)
        Returns true if the given address matches this host
        Parameters:
        address - A host to check
        Returns:
        True if the address is the same (generally if the IP addresses match)
      • toMap

        Map<String,​Object> toMap()
        Creates a map object holding the address, date and reason. This can be used to easily expose the data in JSON endpoints etc.
        Returns:
        A map of name-value pairs.