Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add gcp oauth support #654

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions crates/iceberg/src/io/storage_gcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Loading