Skip to content

Commit 56b849d

Browse files
authored
Rename remote cluster setting to credentials (#94560)
Renames the `cluster.remote.*.authorization` setting to `cluster.remote.*.credentials` since the name is more precise and aligns with the rest of the code base.
1 parent d99d158 commit 56b849d

File tree

15 files changed

+37
-37
lines changed

15 files changed

+37
-37
lines changed

qa/ccs-common-rest/src/yamlRestTest/java/org/elasticsearch/test/rest/yaml/RcsCcsCommonYamlTestSuiteIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ private static void configureRemoteCluster() throws IOException {
229229
final String encodedCrossClusterAccessApiKey = (String) apiKeyMap.get("encoded");
230230

231231
final Settings.Builder builder = Settings.builder()
232-
.put("cluster.remote." + REMOTE_CLUSTER_NAME + ".authorization", encodedCrossClusterAccessApiKey);
232+
.put("cluster.remote." + REMOTE_CLUSTER_NAME + ".credentials", encodedCrossClusterAccessApiKey);
233233
if (randomBoolean()) {
234234
builder.put("cluster.remote." + REMOTE_CLUSTER_NAME + ".mode", "proxy")
235235
.put("cluster.remote." + REMOTE_CLUSTER_NAME + ".proxy_address", fulfillingCluster.getRemoteClusterServerEndpoint(0));

server/src/main/java/org/elasticsearch/common/settings/ClusterSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ public void apply(Settings value, Settings current, Settings previous) {
552552
SimulatePipelineTransportAction.INGEST_NODE_TRANSPORT_ACTION_TIMEOUT,
553553
WriteAckDelay.WRITE_ACK_DELAY_INTERVAL,
554554
WriteAckDelay.WRITE_ACK_DELAY_RANDOMNESS_BOUND,
555-
TcpTransport.isUntrustedRemoteClusterEnabled() ? RemoteClusterService.REMOTE_CLUSTER_AUTHORIZATION : null,
555+
TcpTransport.isUntrustedRemoteClusterEnabled() ? RemoteClusterService.REMOTE_CLUSTER_CREDENTIALS : null,
556556
TcpTransport.isUntrustedRemoteClusterEnabled() ? RemoteClusterPortSettings.REMOTE_CLUSTER_SERVER_ENABLED : null,
557557
TcpTransport.isUntrustedRemoteClusterEnabled() ? RemoteClusterPortSettings.HOST : null,
558558
TcpTransport.isUntrustedRemoteClusterEnabled() ? RemoteClusterPortSettings.PUBLISH_HOST : null,

server/src/main/java/org/elasticsearch/transport/RemoteClusterAware.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public void listenForUpdates(ClusterSettings clusterSettings) {
106106
List<Setting.AffixSetting<?>> remoteClusterSettings = Stream.of(
107107
RemoteClusterService.REMOTE_CLUSTER_COMPRESS,
108108
RemoteClusterService.REMOTE_CLUSTER_PING_SCHEDULE,
109-
TcpTransport.isUntrustedRemoteClusterEnabled() ? RemoteClusterService.REMOTE_CLUSTER_AUTHORIZATION : null,
109+
TcpTransport.isUntrustedRemoteClusterEnabled() ? RemoteClusterService.REMOTE_CLUSTER_CREDENTIALS : null,
110110
RemoteConnectionStrategy.REMOTE_CONNECTION_MODE,
111111
SniffConnectionStrategy.REMOTE_CLUSTERS_PROXY,
112112
SniffConnectionStrategy.REMOTE_CLUSTER_SEEDS,

server/src/main/java/org/elasticsearch/transport/RemoteClusterService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ public final class RemoteClusterService extends RemoteClusterAware implements Cl
122122
)
123123
);
124124

125-
public static final Setting.AffixSetting<String> REMOTE_CLUSTER_AUTHORIZATION = Setting.affixKeySetting(
125+
public static final Setting.AffixSetting<String> REMOTE_CLUSTER_CREDENTIALS = Setting.affixKeySetting(
126126
"cluster.remote.",
127-
"authorization",
127+
"credentials",
128128
key -> Setting.simpleString(key, v -> {}, Setting.Property.Dynamic, Setting.Property.NodeScope, Setting.Property.Filtered)
129129
);
130130

server/src/main/java/org/elasticsearch/transport/RemoteConnectionStrategy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
import java.util.stream.Stream;
4545

4646
import static org.elasticsearch.core.Strings.format;
47-
import static org.elasticsearch.transport.RemoteClusterService.REMOTE_CLUSTER_AUTHORIZATION;
47+
import static org.elasticsearch.transport.RemoteClusterService.REMOTE_CLUSTER_CREDENTIALS;
4848

4949
public abstract class RemoteConnectionStrategy implements TransportConnectionListener, Closeable {
5050

@@ -142,7 +142,7 @@ public Writeable.Reader<RemoteConnectionInfo.ModeInfo> getReader() {
142142
}
143143

144144
static ConnectionProfile buildConnectionProfile(String clusterAlias, Settings settings) {
145-
final String transportProfile = REMOTE_CLUSTER_AUTHORIZATION.getConcreteSettingForNamespace(clusterAlias).exists(settings)
145+
final String transportProfile = REMOTE_CLUSTER_CREDENTIALS.getConcreteSettingForNamespace(clusterAlias).exists(settings)
146146
? RemoteClusterPortSettings.REMOTE_CLUSTER_PROFILE
147147
: TransportSettings.DEFAULT_PROFILE;
148148

server/src/test/java/org/elasticsearch/transport/RemoteClusterConnectionTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ private void doTestGetConnectionInfo(boolean hasClusterCredentials) throws Excep
451451
settings = Settings.builder()
452452
.put(settings)
453453
.put(
454-
RemoteClusterService.REMOTE_CLUSTER_AUTHORIZATION.getConcreteSettingForNamespace(clusterAlias).getKey(),
454+
RemoteClusterService.REMOTE_CLUSTER_CREDENTIALS.getConcreteSettingForNamespace(clusterAlias).getKey(),
455455
randomAlphaOfLength(20)
456456
)
457457
.build();
@@ -638,7 +638,7 @@ private void doTestCollectNodes(boolean hasClusterCredentials) throws Exception
638638
settings = Settings.builder()
639639
.put(settings)
640640
.put(
641-
RemoteClusterService.REMOTE_CLUSTER_AUTHORIZATION.getConcreteSettingForNamespace(clusterAlias).getKey(),
641+
RemoteClusterService.REMOTE_CLUSTER_CREDENTIALS.getConcreteSettingForNamespace(clusterAlias).getKey(),
642642
randomAlphaOfLength(20)
643643
)
644644
.build();

server/src/test/java/org/elasticsearch/transport/RemoteClusterServiceTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public void testSettingsAreRegistered() {
8989
assertTrue(ClusterSettings.BUILT_IN_CLUSTER_SETTINGS.contains(SniffConnectionStrategy.REMOTE_CONNECTIONS_PER_CLUSTER));
9090
assertTrue(ClusterSettings.BUILT_IN_CLUSTER_SETTINGS.contains(SniffConnectionStrategy.REMOTE_CLUSTER_SEEDS));
9191
if (TcpTransport.isUntrustedRemoteClusterEnabled()) {
92-
assertTrue(ClusterSettings.BUILT_IN_CLUSTER_SETTINGS.contains(RemoteClusterService.REMOTE_CLUSTER_AUTHORIZATION));
92+
assertTrue(ClusterSettings.BUILT_IN_CLUSTER_SETTINGS.contains(RemoteClusterService.REMOTE_CLUSTER_CREDENTIALS));
9393
}
9494
assertTrue(ClusterSettings.BUILT_IN_CLUSTER_SETTINGS.contains(SniffConnectionStrategy.REMOTE_NODE_CONNECTIONS));
9595
assertTrue(ClusterSettings.BUILT_IN_CLUSTER_SETTINGS.contains(ProxyConnectionStrategy.PROXY_ADDRESS));

server/src/test/java/org/elasticsearch/transport/RemoteClusterSettingsTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import static org.elasticsearch.test.NodeRoles.nonRemoteClusterClientNode;
2323
import static org.elasticsearch.test.NodeRoles.remoteClusterClientNode;
24-
import static org.elasticsearch.transport.RemoteClusterService.REMOTE_CLUSTER_AUTHORIZATION;
24+
import static org.elasticsearch.transport.RemoteClusterService.REMOTE_CLUSTER_CREDENTIALS;
2525
import static org.elasticsearch.transport.RemoteClusterService.REMOTE_CLUSTER_SKIP_UNAVAILABLE;
2626
import static org.elasticsearch.transport.RemoteClusterService.REMOTE_INITIAL_CONNECTION_TIMEOUT_SETTING;
2727
import static org.elasticsearch.transport.RemoteClusterService.REMOTE_NODE_ATTRIBUTE;
@@ -77,13 +77,13 @@ public void testSeedsDefault() {
7777

7878
public void testAuthorizationDefault() {
7979
final String alias = randomAlphaOfLength(8);
80-
assertThat(REMOTE_CLUSTER_AUTHORIZATION.getConcreteSettingForNamespace(alias).get(Settings.EMPTY), emptyString());
80+
assertThat(REMOTE_CLUSTER_CREDENTIALS.getConcreteSettingForNamespace(alias).get(Settings.EMPTY), emptyString());
8181
}
8282

8383
public void testAuthorizationFiltered() {
8484
final String alias = randomAlphaOfLength(8);
8585
assertThat(
86-
REMOTE_CLUSTER_AUTHORIZATION.getConcreteSettingForNamespace(alias).getProperties(),
86+
REMOTE_CLUSTER_CREDENTIALS.getConcreteSettingForNamespace(alias).getProperties(),
8787
Matchers.hasItem(Setting.Property.Filtered)
8888
);
8989
}
@@ -96,11 +96,11 @@ public void testProxyDefault() {
9696
public void testRemoteClusterEmptyOrNullApiKey() {
9797
// simple validation
9898
Settings settings = Settings.builder()
99-
.put("cluster.remote.cluster1.authorization", "apikey")
100-
.put("cluster.remote.cluster3.authorization", (String) null)
99+
.put("cluster.remote.cluster1.credentials", "apikey")
100+
.put("cluster.remote.cluster3.credentials", (String) null)
101101
.build();
102102
try {
103-
REMOTE_CLUSTER_AUTHORIZATION.getAllConcreteSettings(settings).forEach(setting -> setting.get(settings));
103+
REMOTE_CLUSTER_CREDENTIALS.getAllConcreteSettings(settings).forEach(setting -> setting.get(settings));
104104
} catch (Throwable t) {
105105
fail("Cluster Settings must be able to accept a null, empty, or non-empty string. Exception: " + t.getMessage());
106106
}

server/src/test/java/org/elasticsearch/transport/RemoteConnectionStrategyTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import org.elasticsearch.core.TimeValue;
1515
import org.elasticsearch.test.ESTestCase;
1616

17-
import static org.elasticsearch.transport.RemoteClusterService.REMOTE_CLUSTER_AUTHORIZATION;
17+
import static org.elasticsearch.transport.RemoteClusterService.REMOTE_CLUSTER_CREDENTIALS;
1818
import static org.mockito.Mockito.mock;
1919

2020
public class RemoteConnectionStrategyTests extends ESTestCase {
@@ -126,7 +126,7 @@ public void testTransportProfile() {
126126

127127
// New rcs connection with credentials
128128
for (RemoteConnectionStrategy.ConnectionStrategy strategy : RemoteConnectionStrategy.ConnectionStrategy.values()) {
129-
String settingKey = REMOTE_CLUSTER_AUTHORIZATION.getConcreteSettingForNamespace(clusterAlias).getKey();
129+
String settingKey = REMOTE_CLUSTER_CREDENTIALS.getConcreteSettingForNamespace(clusterAlias).getKey();
130130
final Settings settings = Settings.builder().put(settingKey, randomAlphaOfLength(20)).build();
131131
ConnectionProfile profile = RemoteConnectionStrategy.buildConnectionProfile(clusterAlias, settings);
132132
assertEquals(

server/src/test/java/org/elasticsearch/transport/SniffConnectionStrategyTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void setUp() throws Exception {
7070
final Settings.Builder builder = Settings.builder().put(modeKey, "sniff");
7171
if (hasClusterCredentials) {
7272
builder.put(
73-
RemoteClusterService.REMOTE_CLUSTER_AUTHORIZATION.getConcreteSettingForNamespace(clusterAlias).getKey(),
73+
RemoteClusterService.REMOTE_CLUSTER_CREDENTIALS.getConcreteSettingForNamespace(clusterAlias).getKey(),
7474
randomAlphaOfLength(20)
7575
);
7676
}

0 commit comments

Comments
 (0)