Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions core/src/main/scala/kafka/admin/S3TestCommand.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package kafka.admin

import com.automq.stream.utils.S3Utils
import com.automq.stream.utils.PingS3Helper
import joptsimple.OptionSpec
import kafka.utils.{CommandDefaultOptions, CommandLineUtils, Exit, Logging}
import software.amazon.awssdk.auth.credentials.{AwsBasicCredentials, StaticCredentialsProvider}
Expand Down Expand Up @@ -52,16 +52,16 @@ object S3TestCommand extends Logging {
val forcePathStyle = opts.has(opts.forcePathStyleOpt)
val tagging = opts.has(opts.tagging)

val context = S3Utils.S3Context.builder()
.setEndpoint(s3Endpoint)
.setCredentialsProviders(util.List.of(StaticCredentialsProvider.create(AwsBasicCredentials.create(s3AccessKey, s3SecretKey))))
.setBucketName(s3Bucket)
.setRegion(s3Region)
.setForcePathStyle(forcePathStyle)
.setTagging(tagging)
val pingS3Helper = PingS3Helper.builder()
.endpoint(s3Endpoint)
.bucket(s3Bucket)
.region(s3Region)
.credentialsProviders(util.List.of(StaticCredentialsProvider.create(AwsBasicCredentials.create(s3AccessKey, s3SecretKey))))
.isForcePathStyle(forcePathStyle)
.tagging(tagging)
.needPrintToConsole(true)
.build()

S3Utils.checkS3Access(context)
pingS3Helper.pingS3()
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package org.apache.kafka.tools.automq;

import com.automq.s3shell.sdk.model.EndpointProtocol;
import com.automq.stream.utils.S3Utils;
import com.automq.stream.utils.PingS3Helper;
import java.util.List;
import net.sourceforge.argparse4j.inf.ArgumentParser;
import net.sourceforge.argparse4j.inf.Namespace;
Expand Down Expand Up @@ -150,14 +150,16 @@ public String run() {
System.out.println();

//precheck
var context = S3Utils.S3Context.builder()
.setEndpoint(parameter.endpointProtocol.getName() + "://" + parameter.s3Endpoint)
.setCredentialsProviders(List.of(() -> AwsBasicCredentials.create(parameter.s3AccessKey, parameter.s3SecretKey)))
.setBucketName(parameter.s3DataBucket)
.setRegion(parameter.s3Region)
.setForcePathStyle(parameter.s3PathStyle)
PingS3Helper pingS3Helper = PingS3Helper.builder()
.endpoint(parameter.endpointProtocol.getName() + "://" + parameter.s3Endpoint)
.bucket(parameter.s3DataBucket)
.region(parameter.s3Region)
.credentialsProviders(List.of(() -> AwsBasicCredentials.create(parameter.s3AccessKey, parameter.s3SecretKey)))
.isForcePathStyle(parameter.s3PathStyle)
.tagging(false)
.needPrintToConsole(true)
.build();
S3Utils.checkS3Access(context);
pingS3Helper.pingS3();

String s3Url = buildS3Url();
System.out.println("########## S3 URL RESULT ############");
Expand Down