Unable to Get Data Using AWS JavaScript SDK

23 views
Skip to first unread message

Preetham Mudugal

unread,
Jun 22, 2017, 1:36:31 AM6/22/17
to LeoProject.LeoFS
Below is the Sample Code

<script type="text/javascript">

AWS.config.update({
accessKeyId : "xxxxxxxxxxxxxxxxxxxx",
secretAccessKey : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
signatureVersion: 'v4'
});
var ep = new AWS.Endpoint('hostip:port');
var s3 = new AWS.S3({endpoint: ep});
s3.listObjects({params:{Bucket: "testbucket1"}}, function (err, data) {
    if (err) {
      document.getElementById('somediv').innerHTML =
        'Could not load objects from S3';
    } else {
     var html_keys = 'Object Keys:<br />';
                var html_imgs = '';
                
     jQuery.each(data.Contents, function(index, obj) {
                    var params = {Bucket: "testbucket1", Key: obj.Key};
                    var url = s3.getSignedUrl('getObject', params);
                    html_keys += (index + ': ' + obj.Key + '<br />');
                    html_imgs += "<img src='" + url + "'/><br/>";
                });
    
     jQuery("#somediv").html(html_keys);
                jQuery("#somediv").html(html_imgs);
    }
  });
</script>

yoshiyuki kanno

unread,
Jun 23, 2017, 3:48:38 AM6/23/17
to Preetham Mudugal, LeoProject.LeoFS
Hi,

It seems you need to configure endpoints related things.
Please refer https://mocchira.github.io/leofs/installation/cluster/#configure-an-endpoint
.
# That document is not officially published yet however will be before long.

Best,
Kanno.
> --
> You received this message because you are subscribed to the Google Groups
> "LeoProject.LeoFS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to leoproject_leo...@googlegroups.com.
> To post to this group, send email to leoproje...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/leoproject_leofs/3fcdd013-ceef-4a21-8739-8e671403eb95%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Yoshiyuki Kanno
LeoFS Committer(http://leo-project.net/leofs/index.html)
Reply all
Reply to author
Forward
0 new messages