use of com.talend.shaded.com.amazonaws.services.s3.AmazonS3 in project h2o-2 by h2oai.
the class TypeaheadFileRequest method serveS3.
protected JsonArray serveS3(String filter, int limit) {
JsonArray array = new JsonArray();
try {
AmazonS3 s3 = PersistS3.getClient();
filter = Strings.nullToEmpty(filter);
for (Bucket b : s3.listBuckets()) {
if (b.getName().startsWith(filter))
array.add(new JsonPrimitive(b.getName()));
if (array.size() == limit)
break;
}
} catch (IllegalArgumentException xe) {
}
return array;
}
use of com.talend.shaded.com.amazonaws.services.s3.AmazonS3 in project h2o-2 by h2oai.
the class TypeaheadS3BucketRequest method serve.
@Override
protected JsonArray serve(String filter, int limit) {
JsonArray array = new JsonArray();
try {
AmazonS3 s3 = PersistS3.getClient();
filter = Strings.nullToEmpty(filter);
for (Bucket b : s3.listBuckets()) {
if (b.getName().startsWith(filter))
array.add(new JsonPrimitive(b.getName()));
if (array.size() == limit)
break;
}
} catch (IllegalArgumentException xe) {
}
return array;
}
use of com.talend.shaded.com.amazonaws.services.s3.AmazonS3 in project crate by crate.
the class S3ClientHelperTest method testWithCredentials.
@Test
public void testWithCredentials() throws Exception {
AmazonS3 s3Client = s3ClientHelper.client(new URI("s3://user:password@host/path"));
URL url = s3Client.generatePresignedUrl("bucket", "key", new Date(0L));
assertThat(url.toString(), is("https://bucket.s3.amazonaws.com/key?AWSAccessKeyId=user&Expires=0&Signature=o5V2voSQbVEErsUXId6SssCq9OY%3D"));
}
use of com.talend.shaded.com.amazonaws.services.s3.AmazonS3 in project deeplearning4j by deeplearning4j.
the class S3Downloader method paginate.
/**
* Paginates through a bucket's keys invoking the listener
* at each key
* @param bucket the bucket to iterate
* @param listener the listener
*/
public void paginate(String bucket, BucketKeyListener listener) {
AmazonS3 s3 = getClient();
ObjectListing list = s3.listObjects(bucket);
for (S3ObjectSummary summary : list.getObjectSummaries()) {
if (listener != null)
listener.onKey(s3, bucket, summary.getKey());
}
while (list.isTruncated()) {
list = s3.listNextBatchOfObjects(list);
for (S3ObjectSummary summary : list.getObjectSummaries()) {
if (listener != null)
listener.onKey(s3, bucket, summary.getKey());
}
}
}
use of com.talend.shaded.com.amazonaws.services.s3.AmazonS3 in project deeplearning4j by deeplearning4j.
the class S3Downloader method listObjects.
/**
* Simple way of retrieving the listings for a bucket
* @param bucket the bucket to retrieve listings for
* @return the object listing for this bucket
*/
public ObjectListing listObjects(String bucket) {
AmazonS3 s3 = getClient();
ObjectListing list = s3.listObjects(bucket);
return list;
}
Aggregations