Skip to content

Commit 337476b

Browse files
committed
Remove deprecated gcs.use-access-token from gcs filesystem
1 parent b1a543e commit 337476b

File tree

3 files changed

+3
-96
lines changed

3 files changed

+3
-96
lines changed

docs/src/main/sphinx/object-storage/file-system-gcs.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ Cloud Storage:
6868

6969
* - Property
7070
- Description
71-
* - `gcs.use-access-token`
72-
- Flag to set usage of a client-provided OAuth 2.0 token to access Google
73-
Cloud Storage. Defaults to `false`, deprecated to use `gcs.auth-type` instead.
7471
* - `gcs.auth-type`
7572
- Authentication type to use for Google Cloud Storage access. Default to `SERVICE_ACCOUNT`.
7673
Supported values are:

lib/trino-filesystem-gcs/src/main/java/io/trino/filesystem/gcs/GcsFileSystemConfig.java

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
import io.airlift.configuration.Config;
1717
import io.airlift.configuration.ConfigDescription;
1818
import io.airlift.configuration.ConfigSecuritySensitive;
19+
import io.airlift.configuration.DefunctConfig;
1920
import io.airlift.configuration.validation.FileExists;
2021
import io.airlift.units.DataSize;
2122
import io.airlift.units.Duration;
2223
import io.airlift.units.MinDuration;
2324
import jakarta.annotation.Nullable;
24-
import jakarta.validation.constraints.AssertFalse;
2525
import jakarta.validation.constraints.AssertTrue;
2626
import jakarta.validation.constraints.Min;
2727
import jakarta.validation.constraints.NotNull;
@@ -32,6 +32,7 @@
3232

3333
import static io.airlift.units.DataSize.Unit.MEGABYTE;
3434

35+
@DefunctConfig({"gcs.use-access-token"})
3536
public class GcsFileSystemConfig
3637
{
3738
public enum AuthType
@@ -158,20 +159,6 @@ public GcsFileSystemConfig setAuthType(AuthType authType)
158159
return this;
159160
}
160161

161-
@Deprecated
162-
public boolean isUseGcsAccessToken()
163-
{
164-
return useGcsAccessToken.orElse(false);
165-
}
166-
167-
@Deprecated
168-
@Config("gcs.use-access-token")
169-
public GcsFileSystemConfig setUseGcsAccessToken(boolean useGcsAccessToken)
170-
{
171-
this.useGcsAccessToken = Optional.of(useGcsAccessToken);
172-
return this;
173-
}
174-
175162
@Nullable
176163
public String getJsonKey()
177164
{
@@ -303,10 +290,4 @@ public boolean isAuthMethodValid()
303290

304291
return (jsonKey == null) ^ (jsonKeyFilePath == null);
305292
}
306-
307-
@AssertFalse(message = "Cannot set both gcs.use-access-token and gcs.auth-type")
308-
public boolean isAuthTypeAndGcsAccessTokenConfigured()
309-
{
310-
return authType.isPresent() && useGcsAccessToken.isPresent();
311-
}
312293
}

lib/trino-filesystem-gcs/src/test/java/io/trino/filesystem/gcs/TestGcsFileSystemConfig.java

Lines changed: 1 addition & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import io.airlift.units.DataSize;
1818
import io.airlift.units.Duration;
1919
import io.trino.filesystem.gcs.GcsFileSystemConfig.AuthType;
20-
import jakarta.validation.constraints.AssertFalse;
2120
import jakarta.validation.constraints.AssertTrue;
2221
import org.junit.jupiter.api.Test;
2322

@@ -43,7 +42,6 @@ void testDefaults()
4342
.setWriteBlockSize(DataSize.of(16, MEGABYTE))
4443
.setPageSize(100)
4544
.setBatchSize(100)
46-
.setUseGcsAccessToken(false)
4745
.setProjectId(null)
4846
.setEndpoint(Optional.empty())
4947
.setAuthType(AuthType.SERVICE_ACCOUNT)
@@ -90,44 +88,7 @@ void testExplicitPropertyMappings()
9088
.setMinBackoffDelay(new Duration(20, MILLISECONDS))
9189
.setMaxBackoffDelay(new Duration(20, MILLISECONDS))
9290
.setApplicationId("application id");
93-
assertFullMapping(properties, expected, Set.of("gcs.json-key", "gcs.json-key-file-path", "gcs.use-access-token"));
94-
}
95-
96-
// backwards compatibility test, remove if use-access-token is removed
97-
@Test
98-
void testExplicitPropertyMappingsWithDeprecatedUseAccessToken()
99-
{
100-
Map<String, String> properties = ImmutableMap.<String, String>builder()
101-
.put("gcs.read-block-size", "51MB")
102-
.put("gcs.write-block-size", "52MB")
103-
.put("gcs.page-size", "10")
104-
.put("gcs.batch-size", "11")
105-
.put("gcs.project-id", "project")
106-
.put("gcs.endpoint", "http://custom.dns.org:8000")
107-
.put("gcs.use-access-token", "true")
108-
.put("gcs.client.max-retries", "10")
109-
.put("gcs.client.backoff-scale-factor", "4.0")
110-
.put("gcs.client.max-retry-time", "10s")
111-
.put("gcs.client.min-backoff-delay", "20ms")
112-
.put("gcs.client.max-backoff-delay", "20ms")
113-
.put("gcs.application-id", "application id")
114-
.buildOrThrow();
115-
116-
GcsFileSystemConfig expected = new GcsFileSystemConfig()
117-
.setReadBlockSize(DataSize.of(51, MEGABYTE))
118-
.setWriteBlockSize(DataSize.of(52, MEGABYTE))
119-
.setPageSize(10)
120-
.setBatchSize(11)
121-
.setProjectId("project")
122-
.setEndpoint(Optional.of("http://custom.dns.org:8000"))
123-
.setUseGcsAccessToken(true)
124-
.setMaxRetries(10)
125-
.setBackoffScaleFactor(4.0)
126-
.setMaxRetryTime(new Duration(10, SECONDS))
127-
.setMinBackoffDelay(new Duration(20, MILLISECONDS))
128-
.setMaxBackoffDelay(new Duration(20, MILLISECONDS))
129-
.setApplicationId("application id");
130-
assertFullMapping(properties, expected, Set.of("gcs.json-key", "gcs.json-key-file-path", "gcs.auth-type"));
91+
assertFullMapping(properties, expected, Set.of("gcs.json-key", "gcs.json-key-file-path"));
13192
}
13293

13394
@Test
@@ -165,37 +126,5 @@ public void testValidation()
165126
"retryDelayValid",
166127
"gcs.client.min-backoff-delay must be less than or equal to gcs.client.max-backoff-delay",
167128
AssertTrue.class);
168-
169-
assertFailsValidation(
170-
new GcsFileSystemConfig()
171-
.setAuthType(AuthType.ACCESS_TOKEN)
172-
.setUseGcsAccessToken(true),
173-
"authTypeAndGcsAccessTokenConfigured",
174-
"Cannot set both gcs.use-access-token and gcs.auth-type",
175-
AssertFalse.class);
176-
177-
assertFailsValidation(
178-
new GcsFileSystemConfig()
179-
.setAuthType(AuthType.ACCESS_TOKEN)
180-
.setUseGcsAccessToken(false),
181-
"authTypeAndGcsAccessTokenConfigured",
182-
"Cannot set both gcs.use-access-token and gcs.auth-type",
183-
AssertFalse.class);
184-
185-
assertFailsValidation(
186-
new GcsFileSystemConfig()
187-
.setUseGcsAccessToken(true)
188-
.setAuthType(AuthType.SERVICE_ACCOUNT),
189-
"authTypeAndGcsAccessTokenConfigured",
190-
"Cannot set both gcs.use-access-token and gcs.auth-type",
191-
AssertFalse.class);
192-
193-
assertFailsValidation(
194-
new GcsFileSystemConfig()
195-
.setUseGcsAccessToken(false)
196-
.setAuthType(AuthType.SERVICE_ACCOUNT),
197-
"authTypeAndGcsAccessTokenConfigured",
198-
"Cannot set both gcs.use-access-token and gcs.auth-type",
199-
AssertFalse.class);
200129
}
201130
}

0 commit comments

Comments
 (0)