I am trying to use aws-sdk-java AwsS3client to talk with a mini repository. From the CLI I can do:
aws --profile=minioplay --endpoint-url https://play.minio.io:9000 s3 cp logback.xml s3://miniohstest-jixusroqeb --debug
this way using the default profile and user endpoint. Not sure how to do this (can I?) From java sdk. I roughly translated the above command awscliinto this scala fragment:
val cred = ...
val endpoint = "https://play.minio.io:9000"
val client = AmazonS3ClientBuilder
.standard()
.withCredentials(cred)
.withEndpointConfiguration(
new EndpointConfiguration(
endpoint,
AwsHostNameUtils.parseRegion(endpoint, AmazonS3Client.S3_SERVICE_NAME)
)
)
.build()
Using the client above, I can fulfill very simple queries, for example:
client.listBuckets().asScala.foreach(println(_))
which is working. But when I try to do something advanced, for example:
val listRequest = new ListObjectsRequest()
.withBucketName("miniohstest-jixusroqeb")
val res = client.listObjects(listRequest)
res.getObjectSummaries.forEach(x => println(x.getKey))
it throws the following exception:
Exception in thread "main" com.amazonaws.SdkClientException: Unable to execute HTTP request: miniohstest-jixusroqeb.play.minio.io
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleRetryableException(AmazonHttpClient.java:1114)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1064)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:743)
What am I doing wrong?
source
share