From a86197d401d8d5b028c50428c0c5750277e61d7d Mon Sep 17 00:00:00 2001 From: Shawn Yang <111809252+sfc-gh-shyang@users.noreply.github.com> Date: Wed, 17 Jul 2024 14:59:41 -0700 Subject: [PATCH] SNOW-658339: Implement CLOUD_PROVIDER_TOKEN secret type for Java (#120) * Implement CLOUD_PROVIDER_TOKEN secret type for Java Udx * Address review comments --------- Co-authored-by: Shawn Yang --- .../types/CloudProviderToken.java | 28 +++++++++++++++++++ .../snowpark_java/types/SnowflakeSecrets.java | 9 ++++++ 2 files changed, 37 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..f4cb9f4e --- /dev/null +++ b/src/main/java/com/snowflake/snowpark_java/types/CloudProviderToken.java @@ -0,0 +1,28 @@ +package com.snowflake.snowpark_java.types; + +/** The Snowflake class provides access to the CloudProviderToken secret object with the following properties: accessKeyId, + * secretAccessKey, and token.*/ + +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. *