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

gcp-token on v0.21.0 for build #3540

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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: 13 additions & 1 deletion rust/lance-io/src/object_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use lance_core::utils::tokio::get_num_compute_intensive_cpus;
use object_store::aws::{
AmazonS3ConfigKey, AwsCredential as ObjectStoreAwsCredential, AwsCredentialProvider,
};
use object_store::gcp::GoogleCloudStorageBuilder;
use object_store::gcp::{GcpCredential, GoogleCloudStorageBuilder};
use object_store::{
aws::AmazonS3Builder, azure::AzureConfigKey, gcp::GoogleConfigKey, local::LocalFileSystem,
memory::InMemory, CredentialProvider, Error as ObjectStoreError, Result as ObjectStoreResult,
Expand Down Expand Up @@ -839,6 +839,10 @@ impl StorageOptions {
})
.collect()
}

pub fn get(&self, key: &str) -> Option<&String> {
self.0.get(key)
}
}

impl From<HashMap<String, String>> for StorageOptions {
Expand Down Expand Up @@ -929,6 +933,14 @@ async fn configure_store(
for (key, value) in storage_options.as_gcs_options() {
builder = builder.with_config(key, value);
}
let token_key = "google_storage_token";
if let Some(storage_token) = storage_options.get(token_key) {
let credential = GcpCredential {
bearer: storage_token.to_string(),
};
let credential_provider = Arc::new(StaticCredentialProvider::new(credential)) as _;
builder = builder.with_credentials(credential_provider);
}
let store = builder.build()?;
let store = Arc::new(store).traced();

Expand Down
Loading