java.lang.Object
org.elasticsearch.license.RemoteClusterLicenseChecker
Checks remote clusters for license compatibility with a specified licensed feature.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classEncapsulates a remote cluster license check.static final classEncapsulates the license info of a remote cluster. -
Constructor Summary
ConstructorsConstructorDescriptionRemoteClusterLicenseChecker(Client client, LicensedFeature feature) Constructs a remote cluster license checker with the specified licensed feature for checking license compatibility. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildErrorMessage(LicensedFeature feature, RemoteClusterLicenseChecker.RemoteClusterLicenseInfo remoteClusterLicenseInfo) Constructs an error message for license incompatibility.voidcheckRemoteClusterLicenses(List<String> clusterAliases, ActionListener<RemoteClusterLicenseChecker.LicenseCheck> listener) Checks the specified clusters for license compatibility.static booleancontainsRemoteIndex(Collection<String> indices) Predicate to test if the collection of index names contains any that represent the name of a remote index.static booleanisRemoteIndex(String index) Predicate to test if the index name represents the name of a remote index.remoteClusterAliases(Set<String> remoteClusters, List<String> indices) Extract the list of remote cluster aliases from the list of index names.remoteIndices(Collection<String> indices) Filters the collection of index names for names that represent a remote index.
-
Constructor Details
-
RemoteClusterLicenseChecker
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 isnulla check is only performed on whether the license is active.- Parameters:
client- the clientfeature- 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 checklistener- a callback
-
isRemoteIndex
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
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
Filters the collection of index names for names that represent a remote index. Remote index names are of the formcluster_name:index_name.- Parameters:
indices- the collection of index names- Returns:
- list of index names that represent remote index names
-
remoteClusterAliases
Extract the list of remote cluster aliases from the list of index names. Remote index names are of the formcluster_alias:index_nameand 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 clustersindices- 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
-