purbanow commented on a change in pull request #12149:
URL: https://github.com/apache/beam/pull/12149#discussion_r453504599



##########
File path: 
sdks/java/io/snowflake/src/main/java/org/apache/beam/sdk/io/snowflake/SnowflakeIO.java
##########
@@ -960,26 +953,44 @@ public static DataSourceConfiguration create(DataSource 
dataSource) {
      * @param credentials - an instance of {@link SnowflakeCredentials}.
      */
     public static DataSourceConfiguration create(SnowflakeCredentials 
credentials) {
-      if (credentials instanceof UsernamePasswordSnowflakeCredentials) {
-        return new AutoValue_SnowflakeIO_DataSourceConfiguration.Builder()
-            .setValidate(true)
-            .setUsername(((UsernamePasswordSnowflakeCredentials) 
credentials).getUsername())
-            .setPassword(((UsernamePasswordSnowflakeCredentials) 
credentials).getPassword())
-            .build();
-      } else if (credentials instanceof OAuthTokenSnowflakeCredentials) {
-        return new AutoValue_SnowflakeIO_DataSourceConfiguration.Builder()
-            .setValidate(true)
-            .setOauthToken(((OAuthTokenSnowflakeCredentials) 
credentials).getToken())
-            .build();
-      } else if (credentials instanceof KeyPairSnowflakeCredentials) {
-        return new AutoValue_SnowflakeIO_DataSourceConfiguration.Builder()
-            .setValidate(true)
-            .setUsername(((KeyPairSnowflakeCredentials) 
credentials).getUsername())
-            .setPrivateKey(((KeyPairSnowflakeCredentials) 
credentials).getPrivateKey())
-            .build();
-      }
-      throw new IllegalArgumentException(
-          "Can't create DataSourceConfiguration from given credentials");
+      return credentials.createSnowflakeDataSourceConfiguration();
+    }
+
+    /**
+     * Creates {@link DataSourceConfiguration} from instance of {@link

Review comment:
       I removed this improvement from this PR. 




----------------------------------------------------------------
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]


Reply via email to