purbanow commented on a change in pull request #12618:
URL: https://github.com/apache/beam/pull/12618#discussion_r482085294
##########
File path:
sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/SnowflakeIO.java
##########
@@ -1532,26 +1767,47 @@ public DataSource buildDatasource() {
SnowflakeBasicDataSource basicDataSource = new
SnowflakeBasicDataSource();
basicDataSource.setUrl(buildUrl());
- if (getUsername() != null) {
- basicDataSource.setUser(getUsername());
+ if (isNotEmpty(getOauthToken())) {
+ basicDataSource.setOauthToken(getOauthToken().get());
+ } else if (isNotEmpty(getUsername()) && getPrivateKey() != null) {
+ basicDataSource.setUser(getUsername().get());
+ basicDataSource.setPrivateKey(getPrivateKey());
+ } else if (isNotEmpty(getUsername())
+ && isNotEmpty(getPrivateKeyPassphrase())
+ && isNotEmpty(getRawPrivateKey())) {
+ PrivateKey privateKey =
+ KeyPairUtils.preparePrivateKey(
+ getRawPrivateKey().get(), getPrivateKeyPassphrase().get());
+ basicDataSource.setPrivateKey(privateKey);
+ basicDataSource.setUser(getUsername().get());
+
Review comment:
It make sense to hide those options.
I tried to hide those options but without success. Do you have any tips how
to accomplish this ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]