danielcweeks commented on code in PR #14333:
URL: https://github.com/apache/iceberg/pull/14333#discussion_r2519943350


##########
gcp/src/main/java/org/apache/iceberg/gcp/gcs/PrefixedStorage.java:
##########
@@ -117,5 +126,54 @@ public void close() {
       // GCS Storage does not appear to be closable, so release the reference
       storage = null;
     }
+
+    if (null != gcsFileSystem) {
+      gcsFileSystem.close();
+      gcsFileSystem = null;
+    }
+  }
+
+  static Credentials getCredentials(Map<String, String> properties, 
CloseableGroup closeableGroup) {
+    GCPProperties gcpProperties = new GCPProperties(properties);
+    if (gcpProperties.oauth2Token().isPresent()) {
+      return GCPAuthUtils.oauth2CredentialsFromGcpProperties(
+          new GCPProperties(properties), closeableGroup);
+    } else if (gcpProperties.noAuth()) {
+      return NoCredentials.getInstance();
+    } else {
+      return null;
+    }
+  }
+
+  public GcsFileSystem gcsFileSystem() {
+    if (gcsFileSystem == null) {
+      synchronized (this) {
+        if (gcsFileSystem == null) {
+          this.gcsFileSystem = gcsFileSystemSupplier.get();
+        }
+      }
+    }
+    return this.gcsFileSystem;
+  }
+
+  private SerializableSupplier<GcsFileSystem> getGcsFileSystemSupplier(
+      Map<String, String> properties) {
+    ImmutableMap.Builder<String, String> propertiesWithUserAgent =
+        new ImmutableMap.Builder<String, String>()
+            .putAll(properties)
+            .put("user-agent", GCS_FILE_IO_USER_AGENT);
+    GcsAnalyticsCoreOptions gcsAnalyticsCoreOptions =
+        new GcsAnalyticsCoreOptions("", propertiesWithUserAgent.build());
+    GcsFileSystemOptions fileSystemOptions = 
gcsAnalyticsCoreOptions.getGcsFileSystemOptions();

Review Comment:
   Are all of the configs/options supported in `GCSProperties` supported with 
the `GcsFileSystem` implementation?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to