Skip to content

Conversation

chenjian2664
Copy link
Contributor

@chenjian2664 chenjian2664 commented Sep 22, 2025

This makes it easier to add new GCS authentication types in the future
also deprecated gcs.use-access-token

Description

Additional context and related issues

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text:

## Section
* Replace `gcs.use-access-token` with `gcs.auth-type` configuration. ({issue}`issuenumber`)

@wendigo
Copy link
Contributor

wendigo commented Sep 22, 2025

I've restored compatibility mode for gcs.use-access-token

// FALSE is mapped to DEFAULT
public static AuthType fromString(String value)
{
return switch (value.toUpperCase(ENGLISH)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hacky. I also wanted backward compatibility here but I think deprecating setUseAccessToken but still keeping it. And add validation that setUseAccessToken is not used together with setAuthType would be cleaner

Copy link
Contributor

@marcinsbd marcinsbd Sep 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. +1 for the deprecation ( @ Deprecated and even @ ConfigHidden) and mutual exclusiveness of those properties
  2. should we add the ticket with next release after this one introducing new property for removing the deprecated property

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcinsbd Agree with on " add the ticket with next release after this one introducing new property", I am going to add a draft pr for it, and wait current release finalized

@chenjian2664 chenjian2664 changed the title Replace gcs.use-access-token with gcs.auth-type configuration Add gcs.auth-type configuration Sep 23, 2025
@Config("gcs.use-access-token")
public GcsFileSystemConfig setUseGcsAccessToken(boolean useGcsAccessToken)
{
checkArgument(authType == null, "Cannot set both gcs.use-access-token and gcs.auth-type");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the authType is set after user-access-token? This will override the value without clear indication that this shouldn't be called. I think that this approach is not superior to the one I've already proposed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not how validation works.
It is run after all setters are run and we could model it in such way that you know that both setters were called - and that should result in failure.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the setUseGcsAccessToken should be optional in that case

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah - implementation wise changing useGcsAccessToken from boolean to Optional<Boolean> seems natural if we want to go this path.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In TestGcsFileSystemConfig#testDefaults we need use set method explicitly, do you have idea how to check those two property?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testing defaults should be fine. you just assert on getters.
As for testing explicit setting is a bit more tricky. But recently we added assertFullMapping(Map<String, String> properties, T expected, Set<String> skipped) - so you can test scenarios when one setter is used, and then when the other is used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wendigo @losipiuk I'm not sure if this is okay, but please let me know if you have any advice on it

This makes it easier to add new GCS authentication types
in the future. The commit also deprecate `gcs.use-access-token`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants