Class RemoteClusterLicenseChecker

java.lang.Object
org.elasticsearch.license.RemoteClusterLicenseChecker

public final class RemoteClusterLicenseChecker extends Object
Checks remote clusters for license compatibility with a specified licensed feature.
  • Constructor Details

    • RemoteClusterLicenseChecker

      public RemoteClusterLicenseChecker(Client client, @Nullable LicensedFeature feature)
      Constructs a remote cluster license checker with the specified licensed feature for checking license compatibility. The feature does not need to check for the active license state as this is handled by the remote cluster license checker. If the feature is null a check is only performed on whether the license is active.
      Parameters:
      client - the client
      feature - the licensed feature
  • Method Details

    • checkRemoteClusterLicenses

      public void checkRemoteClusterLicenses(List<String> clusterAliases, ActionListener<RemoteClusterLicenseChecker.LicenseCheck> listener)
      Checks the specified clusters for license compatibility. The specified callback will be invoked once if all clusters are license-compatible, otherwise the specified callback will be invoked once on the first cluster that is not license-compatible.
      Parameters:
      clusterAliases - the cluster aliases to check
      listener - a callback
    • isRemoteIndex

      public static boolean isRemoteIndex(String index)
      Predicate to test if the index name represents the name of a remote index.
      Parameters:
      index - the index name
      Returns:
      true if the collection of indices contains a remote index, otherwise false
    • containsRemoteIndex

      public static boolean containsRemoteIndex(Collection<String> indices)
      Predicate to test if the collection of index names contains any that represent the name of a remote index.
      Parameters:
      indices - the collection of index names
      Returns:
      true if the collection of index names contains a name that represents a remote index, otherwise false
    • remoteIndices

      public static List<String> remoteIndices(Collection<String> indices)
      Filters the collection of index names for names that represent a remote index. Remote index names are of the form cluster_name:index_name.
      Parameters:
      indices - the collection of index names
      Returns:
      list of index names that represent remote index names
    • remoteClusterAliases

      public static List<String> remoteClusterAliases(Set<String> remoteClusters, List<String> indices)
      Extract the list of remote cluster aliases from the list of index names. Remote index names are of the form cluster_alias:index_name and the cluster_alias is extracted (and expanded if it is a wildcard) for each index name that represents a remote index.
      Parameters:
      remoteClusters - the aliases for remote clusters
      indices - the collection of index names
      Returns:
      the remote cluster names
    • buildErrorMessage

      public static String buildErrorMessage(LicensedFeature feature, RemoteClusterLicenseChecker.RemoteClusterLicenseInfo remoteClusterLicenseInfo)
      Constructs an error message for license incompatibility.
      Parameters:
      feature - the name of the feature that initiated the remote cluster license check.
      remoteClusterLicenseInfo - the remote cluster license info of the cluster that failed the license check
      Returns:
      an error message representing license incompatibility