From c066fb56eb462d8b196715ba46e19d6f4cb2f45a Mon Sep 17 00:00:00 2001 From: Gisli Magnusson Date: Wed, 25 Dec 2024 15:57:44 +0000 Subject: [PATCH] Swtich to list from walk as it seems more stble for S3. --- .../java/org/gorpipe/s3/driver/S3SourceProvider.java | 10 ++++------ .../oci/driver/UTestOCIObjectStorageSourceType.java | 6 +++++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/src/main/java/org/gorpipe/s3/driver/S3SourceProvider.java b/drivers/src/main/java/org/gorpipe/s3/driver/S3SourceProvider.java index bf8a9da2..28ae0290 100644 --- a/drivers/src/main/java/org/gorpipe/s3/driver/S3SourceProvider.java +++ b/drivers/src/main/java/org/gorpipe/s3/driver/S3SourceProvider.java @@ -135,8 +135,6 @@ private S3Client createClient(Credentials cred) { builder.httpClientBuilder(httpClientBuilder); - - var metricsPub = new PrometheusMetricPublisher(); builder.overrideConfiguration(c -> c.addMetricPublisher(metricsPub)); @@ -157,8 +155,8 @@ private S3Client createClient(Credentials cred) { AwsCredentialsProvider getCredentialsProvider(Credentials cred) { if (cred == null || cred.isNull()) { log.info("CredentialsProvider: DefaultCredentialsProvider for null creds"); - throw new IllegalArgumentException("Credentials are required for S3 access"); - //return DefaultCredentialsProvider.create(); + //throw new IllegalArgumentException("Credentials are required for S3 access"); + return DefaultCredentialsProvider.create(); } else { var awsKey = cred.getOrDefault(Credentials.Attr.KEY, ""); var awsSecret = cred.getOrDefault(Credentials.Attr.SECRET, ""); @@ -182,8 +180,8 @@ AwsCredentialsProvider getCredentialsProvider(Credentials cred) { } } else { log.info(String.format("CredentialsProvider: DefaultCredentialsProvider for %s:%s", cred.getService(), cred.getLookupKey())); - throw new IllegalArgumentException(String.format("CredentialsProvider: DefaultCredentialsProvider for %s:%s", cred.getService(), cred.getLookupKey())); - //return DefaultCredentialsProvider.create(); + //throw new IllegalArgumentException(String.format("CredentialsProvider: DefaultCredentialsProvider for %s:%s", cred.getService(), cred.getLookupKey())); + return DefaultCredentialsProvider.create(); } } } diff --git a/drivers/src/test/java/org/gorpipe/oci/driver/UTestOCIObjectStorageSourceType.java b/drivers/src/test/java/org/gorpipe/oci/driver/UTestOCIObjectStorageSourceType.java index e10c6265..1fc9932b 100644 --- a/drivers/src/test/java/org/gorpipe/oci/driver/UTestOCIObjectStorageSourceType.java +++ b/drivers/src/test/java/org/gorpipe/oci/driver/UTestOCIObjectStorageSourceType.java @@ -1,5 +1,6 @@ package org.gorpipe.oci.driver; +import org.gorpipe.base.security.Credentials; import org.gorpipe.gor.driver.GorDriverFactory; import org.gorpipe.gor.driver.meta.SourceReference; import org.gorpipe.utils.DriverUtils; @@ -92,7 +93,10 @@ public void testResolveS3HttpUrl() throws IOException { @Test public void testResolveS3OciHttpUrl() throws IOException { var source = GorDriverFactory.fromConfig().resolveDataSource( - new SourceReference("s3://namespace.objectstorage.us-ashburn-1.oci.customer-oci.com/the/path.dat", null, null, null, null, false)); + new SourceReference("s3://namespace.objectstorage.us-ashburn-1.oci.customer-oci.com/the/path.dat", + DriverUtils.createSecurityContext("s3", "namespace.objectstorage.us-ashburn-1.oci.customer-oci.com", + Credentials.OwnerType.System, "", "dummy", "dummy", + "", ""), null, null, null, false)); assertNotEquals(OCIObjectStorageSourceType.OCI_OBJECT_STORAGE, source.getSourceType()); }