MCPcopy Create free account
hub / github.com/apache/datafusion / get_gcs_object_store_builder

Function get_gcs_object_store_builder

datafusion-cli/src/object_storage.rs:292–312  ·  view source on GitHub ↗
(
    url: &Url,
    gs_options: &GcpOptions,
)

Source from the content-addressed store, hash-verified

290}
291
292pub fn get_gcs_object_store_builder(
293 url: &Url,
294 gs_options: &GcpOptions,
295) -> Result<GoogleCloudStorageBuilder> {
296 let bucket_name = get_bucket_name(url)?;
297 let mut builder = GoogleCloudStorageBuilder::from_env().with_bucket_name(bucket_name);
298
299 if let Some(service_account_path) = &gs_options.service_account_path {
300 builder = builder.with_service_account_path(service_account_path);
301 }
302
303 if let Some(service_account_key) = &gs_options.service_account_key {
304 builder = builder.with_service_account_key(service_account_key);
305 }
306
307 if let Some(application_credentials_path) = &gs_options.application_credentials_path {
308 builder = builder.with_application_credentials(application_credentials_path);
309 }
310
311 Ok(builder)
312}
313
314fn get_bucket_name(url: &Url) -> Result<&str> {
315 url.host_str().ok_or_else(|| {

Callers 2

get_object_storeFunction · 0.85
gcs_object_store_builderFunction · 0.85

Calls 2

get_bucket_nameFunction · 0.85
from_envFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…