From 608ab65562558a211d484ffb21bc40ad01017f4d Mon Sep 17 00:00:00 2001 From: Artem Prigoda Date: Tue, 12 Apr 2022 19:50:08 +0200 Subject: [PATCH] Expose proxy settings for GCS repositories (#85785) They were added in #82737, but not exposed via the GCSPlugin to end users. --- docs/changelog/85785.yaml | 6 +++ .../gcs/GoogleCloudStoragePlugin.java | 5 ++- .../gcs/GoogleCloudStoragePluginTests.java | 39 +++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 docs/changelog/85785.yaml create mode 100644 modules/repository-gcs/src/test/java/org/elasticsearch/repositories/gcs/GoogleCloudStoragePluginTests.java diff --git a/docs/changelog/85785.yaml b/docs/changelog/85785.yaml new file mode 100644 index 0000000000000..171d61af3481f --- /dev/null +++ b/docs/changelog/85785.yaml @@ -0,0 +1,6 @@ +pr: 85785 +summary: Expose proxy settings for GCS repositories +area: Snapshot/Restore +type: bug +issues: + - 84569 diff --git a/modules/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStoragePlugin.java b/modules/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStoragePlugin.java index d1217e83496bc..37120ec49f640 100644 --- a/modules/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStoragePlugin.java +++ b/modules/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStoragePlugin.java @@ -71,7 +71,10 @@ public List> getSettings() { GoogleCloudStorageClientSettings.CONNECT_TIMEOUT_SETTING, GoogleCloudStorageClientSettings.READ_TIMEOUT_SETTING, GoogleCloudStorageClientSettings.APPLICATION_NAME_SETTING, - GoogleCloudStorageClientSettings.TOKEN_URI_SETTING + GoogleCloudStorageClientSettings.TOKEN_URI_SETTING, + GoogleCloudStorageClientSettings.PROXY_TYPE_SETTING, + GoogleCloudStorageClientSettings.PROXY_HOST_SETTING, + GoogleCloudStorageClientSettings.PROXY_PORT_SETTING ); } diff --git a/modules/repository-gcs/src/test/java/org/elasticsearch/repositories/gcs/GoogleCloudStoragePluginTests.java b/modules/repository-gcs/src/test/java/org/elasticsearch/repositories/gcs/GoogleCloudStoragePluginTests.java new file mode 100644 index 0000000000000..bacad22a6b913 --- /dev/null +++ b/modules/repository-gcs/src/test/java/org/elasticsearch/repositories/gcs/GoogleCloudStoragePluginTests.java @@ -0,0 +1,39 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +package org.elasticsearch.repositories.gcs; + +import org.elasticsearch.common.settings.Setting; +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.test.ESTestCase; +import org.junit.Assert; + +import java.util.List; + +public class GoogleCloudStoragePluginTests extends ESTestCase { + + public void testExposedSettings() { + List> settings = new GoogleCloudStoragePlugin(Settings.EMPTY).getSettings(); + + Assert.assertEquals( + List.of( + "gcs.client.*.credentials_file", + "gcs.client.*.endpoint", + "gcs.client.*.project_id", + "gcs.client.*.connect_timeout", + "gcs.client.*.read_timeout", + "gcs.client.*.application_name", + "gcs.client.*.token_uri", + "gcs.client.*.proxy.type", + "gcs.client.*.proxy.host", + "gcs.client.*.proxy.port" + ), + settings.stream().map(Setting::getKey).toList() + ); + } +}