Class LicenseUtils

java.lang.Object
org.elasticsearch.license.LicenseUtils

public class LicenseUtils extends Object
  • Field Details

  • Constructor Details

    • LicenseUtils

      public LicenseUtils()
  • Method Details

    • formatMillis

      public static String formatMillis(long millis)
    • newComplianceException

      public static ElasticsearchSecurityException newComplianceException(String feature)
      Exception to be thrown when a feature action requires a valid license, but license has expired feature accessible through EXPIRED_FEATURE_METADATA in the exception's rest header
    • isLicenseExpiredException

      public static boolean isLicenseExpiredException(ElasticsearchSecurityException exception)
      Checks if a given ElasticsearchSecurityException refers to a feature that requires a valid license, but the license has expired.
    • licenseNeedsExtended

      public static boolean licenseNeedsExtended(License license)
    • signatureNeedsUpdate

      public static boolean signatureNeedsUpdate(License license)
      Checks if the signature of a self generated license with older version needs to be recreated with the new key
    • getMaxCompatibleLicenseVersion

      public static int getMaxCompatibleLicenseVersion()
      Gets the maximum license version this cluster is compatible with. This is semantically different from License.VERSION_CURRENT as that field is the maximum that can be handled _by this node_, whereas this method determines the maximum license version that can be handled _by this cluster_.
    • getExpiryDate

      public static long getExpiryDate(License license)
      Gets the effective expiry date of the given license, including any overrides.
    • status

      public static LicenseStatus status(License license)
      Gets the current status of a license
    • getXPackLicenseStatus

      public static XPackLicenseStatus getXPackLicenseStatus(License license, Clock clock)
      Derive the status from the License for use with XPackLicenseState
      Parameters:
      license - The license used to derive the returned XPackLicenseStatus
      clock - The clock used for expiry checks. Will typically be Clock.systemUTC();
      Returns:
      The status for use with XPackLicenseState
    • getAckMessages

      public static Map<String,String[]> getAckMessages(License newLicense, License currentLicense)
    • getExpiryWarning

      public static String getExpiryWarning(long licenseExpiryDate, long currentTime)