Skip to content

Commit 068c856

Browse files
authored
Rename internal repository actions to be internal (#36244)
This is a follow-up to #36086. It renames the internal repository actions to be prefixed by "internal". This allows the system user to execute the actions. Additionally, this PR stops casting Client to NodeClient. The client we have is a NodeClient so executing the actions will be local.
1 parent a3c1c69 commit 068c856

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/Ccr.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import org.elasticsearch.action.ActionRequest;
1111
import org.elasticsearch.action.ActionResponse;
1212
import org.elasticsearch.client.Client;
13-
import org.elasticsearch.client.node.NodeClient;
1413
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
1514
import org.elasticsearch.cluster.node.DiscoveryNodes;
1615
import org.elasticsearch.cluster.service.ClusterService;
@@ -151,7 +150,7 @@ public Collection<Object> createComponents(
151150
return emptyList();
152151
}
153152

154-
this.repositoryManager.set(new CcrRepositoryManager(settings, clusterService, (NodeClient) client));
153+
this.repositoryManager.set(new CcrRepositoryManager(settings, clusterService, client));
155154

156155
return Arrays.asList(
157156
ccrLicenseChecker,

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/CcrRepositoryManager.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import org.elasticsearch.action.ActionRequest;
1010
import org.elasticsearch.action.support.PlainActionFuture;
11-
import org.elasticsearch.client.node.NodeClient;
11+
import org.elasticsearch.client.Client;
1212
import org.elasticsearch.cluster.service.ClusterService;
1313
import org.elasticsearch.common.settings.Settings;
1414
import org.elasticsearch.transport.RemoteClusterAware;
@@ -22,9 +22,9 @@
2222

2323
class CcrRepositoryManager extends RemoteClusterAware {
2424

25-
private final NodeClient client;
25+
private final Client client;
2626

27-
CcrRepositoryManager(Settings settings, ClusterService clusterService, NodeClient client) {
27+
CcrRepositoryManager(Settings settings, ClusterService clusterService, Client client) {
2828
super(settings);
2929
this.client = client;
3030
listenForUpdates(clusterService.getClusterSettings());
@@ -36,12 +36,12 @@ protected void updateRemoteCluster(String clusterAlias, List<String> addresses,
3636
if (addresses.isEmpty()) {
3737
DeleteInternalCcrRepositoryRequest request = new DeleteInternalCcrRepositoryRequest(repositoryName);
3838
PlainActionFuture<DeleteInternalCcrRepositoryAction.DeleteInternalCcrRepositoryResponse> f = PlainActionFuture.newFuture();
39-
client.executeLocally(DeleteInternalCcrRepositoryAction.INSTANCE, request, f);
39+
client.execute(DeleteInternalCcrRepositoryAction.INSTANCE, request, f);
4040
assert f.isDone() : "Should be completed as it is executed synchronously";
4141
} else {
4242
ActionRequest request = new PutInternalCcrRepositoryRequest(repositoryName, CcrRepository.TYPE);
4343
PlainActionFuture<PutInternalCcrRepositoryAction.PutInternalCcrRepositoryResponse> f = PlainActionFuture.newFuture();
44-
client.executeLocally(PutInternalCcrRepositoryAction.INSTANCE, request, f);
44+
client.execute(PutInternalCcrRepositoryAction.INSTANCE, request, f);
4545
assert f.isDone() : "Should be completed as it is executed synchronously";
4646
}
4747
}

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/repositories/DeleteInternalCcrRepositoryAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
public class DeleteInternalCcrRepositoryAction extends Action<DeleteInternalCcrRepositoryAction.DeleteInternalCcrRepositoryResponse> {
2424

2525
public static final DeleteInternalCcrRepositoryAction INSTANCE = new DeleteInternalCcrRepositoryAction();
26-
public static final String NAME = "cluster:admin/ccr/internal_repository/delete";
26+
public static final String NAME = "internal:admin/ccr/internal_repository/delete";
2727

2828
private DeleteInternalCcrRepositoryAction() {
2929
super(NAME);

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/repositories/PutInternalCcrRepositoryAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
public class PutInternalCcrRepositoryAction extends Action<PutInternalCcrRepositoryAction.PutInternalCcrRepositoryResponse> {
2424

2525
public static final PutInternalCcrRepositoryAction INSTANCE = new PutInternalCcrRepositoryAction();
26-
public static final String NAME = "cluster:admin/ccr/internal_repository/put";
26+
public static final String NAME = "internal:admin/ccr/internal_repository/put";
2727

2828
private PutInternalCcrRepositoryAction() {
2929
super(NAME);

0 commit comments

Comments
 (0)