Skip to content

Commit

Permalink
feat: N5Factory add s3ClientConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
bogovicj committed Jun 5, 2024
1 parent ee0006d commit 836a63a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
<releaseProfiles>sign,deploy-to-scijava</releaseProfiles>

<n5.version>3.2.0</n5.version>
<n5-aws-s3.version>4.1.2</n5-aws-s3.version>
<n5-aws-s3.version>4.1.3-SNAPSHOT</n5-aws-s3.version>
<n5-hdf5.version>2.2.0</n5-hdf5.version>
<n5-imglib2.version>7.0.0</n5-imglib2.version>
<n5-google-cloud.version>4.1.0</n5-google-cloud.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import org.janelia.saalfeldlab.n5.zarr.ZarrKeyValueReader;
import org.janelia.saalfeldlab.n5.zarr.ZarrKeyValueWriter;

import com.amazonaws.ClientConfiguration;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
import com.amazonaws.services.s3.AmazonS3;
Expand Down Expand Up @@ -97,6 +98,7 @@ public class N5Factory implements Serializable {
private String googleCloudProjectId = null;
private String s3Region = null;
private AWSCredentials s3Credentials = null;
private ClientConfiguration s3ClientConfiguration = null;
private boolean s3Anonymous = true;
private String s3Endpoint;

Expand Down Expand Up @@ -185,6 +187,12 @@ public N5Factory s3UseCredentials(final AWSCredentials credentials) {
return this;
}

public N5Factory s3ClientConfiguration(final ClientConfiguration clientConfiguration) {

this.s3ClientConfiguration = clientConfiguration;
return this;
}

@Deprecated
public N5Factory s3RetryWithCredentials() {

Expand All @@ -206,7 +214,7 @@ public N5Factory s3Region(final String s3Region) {
AmazonS3 createS3(final String uri) {

try {
return AmazonS3Utils.createS3(uri, s3Endpoint, AmazonS3Utils.getS3Credentials(s3Credentials, s3Anonymous), s3Region);
return AmazonS3Utils.createS3(uri, s3Endpoint, AmazonS3Utils.getS3Credentials(s3Credentials, s3Anonymous), s3ClientConfiguration, s3Region);
} catch (final Throwable e) {
throw new N5Exception("Could not create s3 client from uri: " + uri, e);
}
Expand Down

0 comments on commit 836a63a

Please sign in to comment.