-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Add gcs.auth-type
configuration
#26681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
I've restored compatibility mode for |
// FALSE is mapped to DEFAULT | ||
public static AuthType fromString(String value) | ||
{ | ||
return switch (value.toUpperCase(ENGLISH)) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- +1 for the deprecation ( @ Deprecated and even @ ConfigHidden) and mutual exclusiveness of those properties
- should we add the ticket with next release after this one introducing new property for removing the deprecated property
There was a problem hiding this comment.
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
gcs.use-access-token
with gcs.auth-type
configurationgcs.auth-type
configuration
@Config("gcs.use-access-token") | ||
public GcsFileSystemConfig setUseGcsAccessToken(boolean useGcsAccessToken) | ||
{ | ||
checkArgument(authType == null, "Cannot set both gcs.use-access-token and gcs.auth-type"); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes it easier to add new GCS authentication types in the future. The commit also deprecate `gcs.use-access-token`
19ece4c
to
4e57b84
Compare
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: