This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-rust.git
The following commit(s) were added to refs/heads/main by this push:
new 4c3e47d7 feat: add gcp oauth support (#654)
4c3e47d7 is described below
commit 4c3e47d765fa6a864c8b9e5604b30e06960af541
Author: Tobias Pütz <[email protected]>
AuthorDate: Wed Oct 9 10:51:41 2024 +0200
feat: add gcp oauth support (#654)
---
crates/iceberg/src/io/storage_gcs.rs | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/crates/iceberg/src/io/storage_gcs.rs
b/crates/iceberg/src/io/storage_gcs.rs
index 0a241079..de938e55 100644
--- a/crates/iceberg/src/io/storage_gcs.rs
+++ b/crates/iceberg/src/io/storage_gcs.rs
@@ -34,11 +34,25 @@ pub const GCS_SERVICE_PATH: &str = "gcs.service.path";
pub const GCS_USER_PROJECT: &str = "gcs.user-project";
/// Allow unauthenticated requests
pub const GCS_NO_AUTH: &str = "gcs.no-auth";
+/// Google Cloud Storage credentials JSON string, base64 encoded.
+///
+/// E.g.
base64::prelude::BASE64_STANDARD.encode(serde_json::to_string(credential).as_bytes())
+pub const GCS_CREDENTIALS_JSON: &str = "gcs.credentials-json";
+/// Google Cloud Storage token
+pub const GCS_TOKEN: &str = "gcs.oauth2.token";
/// Parse iceberg properties to [`GcsConfig`].
pub(crate) fn gcs_config_parse(mut m: HashMap<String, String>) ->
Result<GcsConfig> {
let mut cfg = GcsConfig::default();
+ if let Some(cred) = m.remove(GCS_CREDENTIALS_JSON) {
+ cfg.credential = Some(cred);
+ }
+
+ if let Some(token) = m.remove(GCS_TOKEN) {
+ cfg.token = Some(token);
+ }
+
if let Some(endpoint) = m.remove(GCS_SERVICE_PATH) {
cfg.endpoint = Some(endpoint);
}