scala - How to use AWS Java SDK to connect Complaint S3 Service? -
i trying implement simple java/scala client connect s3 service provided openstack swift(it supports s3 api). codes seems not working when using aws java sdk 1.11.176. share me lights?
thanks!
def listbuckets(config: config, bucketname: string): unit = { val accesskey = "85eb40dxxxxx" val secretkey = "xxxxxxxxxxxx" val endpoint = "https://v01.my.company.net:8080" val credentials = new basicawscredentials(accesskey, secretkey); val clientconfig = new clientconfiguration(); clientconfig.setprotocol(protocol.https); val client = amazons3clientbuilder.standard() .withcredentials(newawsstaticcredentialsprovider(credentials)) .withclientconfiguration(clientconfig) .withpathstyleaccessenabled(true) .withendpointconfiguration(new endpointconfiguration(endpoint, "us-east-1")) .build(); system.out.println(client.listbuckets()) }
error this:
null (service: amazon s3; status code: 400; error code: invalidargument; request id: null; s3 extended request id: null) com.amazonaws.services.s3.model.amazons3exception: null (service: amazon s3; status code: 400; error code: invalidargument; request id: null; s3 extended request id: null), s3 extended request id: null @ com.amazonaws.http.amazonhttpclient$requestexecutor.handleerrorresponse(amazonhttpclient.java:1587) @ com.amazonaws.http.amazonhttpclient$requestexecutor.executeonerequest(amazonhttpclient.java:1257) @ com.amazonaws.http.amazonhttpclient$requestexecutor.executehelper(amazonhttpclient.java:1029) @ com.amazonaws.http.amazonhttpclient$requestexecutor.doexecute(amazonhttpclient.java:741) @ com.amazonaws.http.amazonhttpclient$requestexecutor.executewithtimer(amazonhttpclient.java:715) @ com.amazonaws.http.amazonhttpclient$requestexecutor.execute(amazonhttpclient.java:697) @ com.amazonaws.http.amazonhttpclient$requestexecutor.access$500(amazonhttpclient.java:665) @ com.amazonaws.http.amazonhttpclient$requestexecutionbuilderimpl.execute(amazonhttpclient.java:647) @ com.amazonaws.http.amazonhttpclient.execute(amazonhttpclient.java:511) @ com.amazonaws.services.s3.amazons3client.invoke(amazons3client.java:4227) @ com.amazonaws.services.s3.amazons3client.invoke(amazons3client.java:4174) @ com.amazonaws.services.s3.amazons3client.invoke(amazons3client.java:4168) @ com.amazonaws.services.s3.amazons3client.listbuckets(amazons3client.java:918) @ com.amazonaws.services.s3.amazons3client.listbuckets(amazons3client.java:924)
Comments
Post a Comment