Class SystemCheck

java.lang.Object
io.aiven.commons.system.SystemCheck

public final class SystemCheck extends Object
Checks URLs against the URLs allowed as per the org.apache.kafka.sasl.oauthbearer.allowed.urls environment variable. If the variable is not set all URLs are allowed.
  • Method Details

    • formatError

      public static String formatError(SystemCheck.Type type, String value)
      Format the error message for the specified URL.
      Parameters:
      type - the type check that failed
      value - the value to create an error message for.
      Returns:
      the error message.
    • allowed

      public static boolean allowed(SystemCheck.Type type, String value)
      Checks if the URL is allowed as per the org.apache.kafka.sasl.oauthbearer.allowed.urls environment variable.
      Parameters:
      type - the type to check.
      value - the value to check.
      Returns:
      true if the value is listed in the environment variable for the type, false if the environment variable is not set or the value is not listed.
    • throwIfNotAllowed

      public static void throwIfNotAllowed(SystemCheck.Type type, String value) throws IllegalArgumentException
      Throw an exception if the specified URL is not listed in the system property.
      Parameters:
      type - the type to check.
      value - the value to check
      Throws:
      IllegalArgumentException - if the allowed(Type, String) returns false.