desruisseaux commented on code in PR #40:
URL: https://github.com/apache/sis/pull/40#discussion_r2792467689
##########
endorsed/src/org.apache.sis.cloud.aws/main/org/apache/sis/cloud/aws/s3/ClientFileSystem.java:
##########
@@ -88,20 +106,58 @@ final class ClientFileSystem extends FileSystem {
this.provider = provider;
this.client = client;
this.accessKey = null;
+ this.host = null;
+ this.port = null;
this.separator = DEFAULT_SEPARATOR;
duplicatedSeparator = DEFAULT_SEPARATOR + DEFAULT_SEPARATOR;
}
+ /**
+ * Creates a file system with default hostname and default separator.
+ */
+ ClientFileSystem(final FileService provider, final S3Client client, String
accessKey) {
+ this.provider = provider;
+ this.client = client;
+ this.accessKey = accessKey;
+ this.host = null;
+ this.port = null;
+ this.separator = DEFAULT_SEPARATOR;
+ duplicatedSeparator = DEFAULT_SEPARATOR + DEFAULT_SEPARATOR;
+ }
+
+ /**
+ * Creates a file system with default credential and default separator.
+ */
+ ClientFileSystem(final FileService provider, String accessKey, String
host, Integer port, boolean isHttps) {
+ this.provider = provider;
+ this.accessKey = accessKey;
+ this.host = host;
+ this.port = port;
+ this.isHttps = isHttps;
+ this.separator = DEFAULT_SEPARATOR;
+ duplicatedSeparator = DEFAULT_SEPARATOR + DEFAULT_SEPARATOR;
+
+ String hostname = (port != null ? host+":"+port : host);
+ String protocol = (isHttps ? "https" : "http");
+ this.client = S3Client.builder().endpointOverride(URI.create(protocol
+ "://" + hostname))
+
.serviceConfiguration(S3Configuration.builder().pathStyleAccessEnabled(true).build())
+ .build();
+ }
+
/**
* Creates a new file system with the specified credential.
*
* @param provider the provider creating this file system.
* @param region the AWS region, or {@code null} for default.
+ * @param host the host or {@code null} for aws request
+ * @param port the port or {@code null} for aws request
+ * @param isHttps the protocol is secure or not or {@code null} for
aws request
* @param accessKey the AWS S3 access key for this file system.
* @param secret the password.
* @param separator the separator in paths, or {@code null} for the
default value.
*/
- ClientFileSystem(final FileService provider, final Region region, final
String accessKey, final String secret,
+ ClientFileSystem(final FileService provider, final Region region, final
String host, final Integer port,
+ final Boolean isHttps, final String accessKey, final
String secret,
Review Comment:
Replace `Boolean` argument by `boolean`. The `null` value does not seem to
bring new information in the method body.
--
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]