From a128974815b38b43532d677740da4651ff3853aa Mon Sep 17 00:00:00 2001 From: Shawn Yang Date: Tue, 16 Jul 2024 02:01:26 +0000 Subject: [PATCH] Implement CLOUD_PROVIDER_TOKEN secret type for Java Udx --- .../types/CloudProviderToken.java | 26 +++++++++++++++++++ .../snowpark_java/types/SnowflakeSecrets.java | 9 +++++++ 2 files changed, 35 insertions(+) create mode 100644 src/main/java/com/snowflake/snowpark_java/types/CloudProviderToken.java diff --git a/src/main/java/com/snowflake/snowpark_java/types/CloudProviderToken.java b/src/main/java/com/snowflake/snowpark_java/types/CloudProviderToken.java new file mode 100644 index 00000000..2e109b04 --- /dev/null +++ b/src/main/java/com/snowflake/snowpark_java/types/CloudProviderToken.java @@ -0,0 +1,26 @@ +package com.snowflake.snowpark_java.types; + +/** Custom Snowflake class that provides access to accessKeyId & secretAccessKey & token secret object. */ +public class CloudProviderToken { + private final String accessKeyId; + private final String secretAccessKey; + private final String token; + + public CloudProviderToken(String id, String key, String token) { + this.accessKeyId = id; + this.secretAccessKey = key; + this.token = token; + } + + public String getAccessKeyId() { + return accessKeyId; + } + + public String getSecretAccessKey() { + return secretAccessKey; + } + + public String getToken() { + return token; + } +} diff --git a/src/main/java/com/snowflake/snowpark_java/types/SnowflakeSecrets.java b/src/main/java/com/snowflake/snowpark_java/types/SnowflakeSecrets.java index 0a5f13ea..4438bea4 100644 --- a/src/main/java/com/snowflake/snowpark_java/types/SnowflakeSecrets.java +++ b/src/main/java/com/snowflake/snowpark_java/types/SnowflakeSecrets.java @@ -31,6 +31,15 @@ public UsernamePassword getUsernamePassword(String secretName) { throw new UnsupportedOperationException(); } + /** + * Get the Cloud provider token from the secret. On success, it returns a valid object with access key id, + * secret access key and token. + * + * @param secretName name of the secret object. + */ + public CloudProviderToken getCloudProviderToken(String secretName) { + throw new UnsupportedOperationException(); + } /** * Get the secret generic string of the secret. On success, it returns a valid token string. *