(
url: &Url,
gs_options: &GcpOptions,
)
| 290 | } |
| 291 | |
| 292 | pub 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 | |
| 314 | fn get_bucket_name(url: &Url) -> Result<&str> { |
| 315 | url.host_str().ok_or_else(|| { |
no test coverage detected
searching dependent graphs…