use of com.talend.shaded.com.amazonaws.services.s3.AmazonS3Client in project deeplearning4j by deeplearning4j.
the class S3Uploader method multiPartUpload.
/**
* Multi part upload for big files
* @param file the file to upload
* @param bucketName the bucket name to upload
*/
public void multiPartUpload(File file, String bucketName) {
AmazonS3 client = new AmazonS3Client(creds);
bucketName = ensureValidBucketName(bucketName);
List<Bucket> buckets = client.listBuckets();
for (Bucket b : buckets) if (b.getName().equals(bucketName)) {
doMultiPart(client, bucketName, file);
return;
}
//bucket didn't exist: create it
client.createBucket(bucketName);
doMultiPart(client, bucketName, file);
}
use of com.talend.shaded.com.amazonaws.services.s3.AmazonS3Client in project elasticsearch by elastic.
the class InternalAwsS3Service method client.
@Override
public synchronized AmazonS3 client(Settings repositorySettings, Integer maxRetries, boolean useThrottleRetries, Boolean pathStyleAccess) {
String clientName = CLIENT_NAME.get(repositorySettings);
String foundEndpoint = findEndpoint(logger, repositorySettings, settings, clientName);
AWSCredentialsProvider credentials = buildCredentials(logger, deprecationLogger, settings, repositorySettings, clientName);
Tuple<String, String> clientDescriptor = new Tuple<>(foundEndpoint, credentials.getCredentials().getAWSAccessKeyId());
AmazonS3Client client = clients.get(clientDescriptor);
if (client != null) {
return client;
}
client = new AmazonS3Client(credentials, buildConfiguration(logger, repositorySettings, settings, clientName, maxRetries, foundEndpoint, useThrottleRetries));
if (pathStyleAccess != null) {
client.setS3ClientOptions(new S3ClientOptions().withPathStyleAccess(pathStyleAccess));
}
if (!foundEndpoint.isEmpty()) {
client.setEndpoint(foundEndpoint);
}
clients.put(clientDescriptor, client);
return client;
}
use of com.talend.shaded.com.amazonaws.services.s3.AmazonS3Client in project android-simpl3r by jgilfelt.
the class UploadService method onCreate.
@Override
public void onCreate() {
super.onCreate();
s3Client = new AmazonS3Client(new BasicAWSCredentials(getString(R.string.s3_access_key), getString(R.string.s3_secret)));
nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
IntentFilter f = new IntentFilter();
f.addAction(UPLOAD_CANCELLED_ACTION);
registerReceiver(uploadCancelReceiver, f);
}
use of com.talend.shaded.com.amazonaws.services.s3.AmazonS3Client in project ice by Netflix.
the class BasicManagers method doWork.
private void doWork() {
logger.info("trying to find new tag group and data managers...");
Set<Product> products = Sets.newHashSet(this.products);
Map<Product, BasicTagGroupManager> tagGroupManagers = Maps.newHashMap(this.tagGroupManagers);
TreeMap<Key, BasicDataManager> costManagers = Maps.newTreeMap(this.costManagers);
TreeMap<Key, BasicDataManager> usageManagers = Maps.newTreeMap(this.usageManagers);
Set<Product> newProducts = Sets.newHashSet();
AmazonS3Client s3Client = AwsUtils.getAmazonS3Client();
for (S3ObjectSummary s3ObjectSummary : s3Client.listObjects(config.workS3BucketName, config.workS3BucketPrefix + TagGroupWriter.DB_PREFIX).getObjectSummaries()) {
String key = s3ObjectSummary.getKey();
Product product;
if (key.endsWith("_all")) {
product = null;
} else {
String name = key.substring((config.workS3BucketPrefix + TagGroupWriter.DB_PREFIX).length());
product = config.productService.getProductByName(name);
}
if (!products.contains(product)) {
products.add(product);
newProducts.add(product);
}
}
for (Product product : newProducts) {
tagGroupManagers.put(product, new BasicTagGroupManager(product));
for (ConsolidateType consolidateType : ConsolidateType.values()) {
Key key = new Key(product, consolidateType);
costManagers.put(key, new BasicDataManager(product, consolidateType, true));
usageManagers.put(key, new BasicDataManager(product, consolidateType, false));
}
}
if (newProducts.size() > 0) {
this.costManagers = costManagers;
this.usageManagers = usageManagers;
this.tagGroupManagers = tagGroupManagers;
this.products = products;
}
}
use of com.talend.shaded.com.amazonaws.services.s3.AmazonS3Client in project ice by Netflix.
the class MapDb method upload.
void upload() {
AmazonS3Client s3Client = AwsUtils.getAmazonS3Client();
File dir = new File(config.localDir);
File[] files = dir.listFiles(new FilenameFilter() {
public boolean accept(File file, String fileName) {
return fileName.startsWith(dbName);
}
});
for (File file : files) s3Client.putObject(config.workS3BucketName, config.workS3BucketPrefix + file.getName(), file);
for (File file : files) s3Client.putObject(config.workS3BucketName, config.workS3BucketPrefix + "copy" + file.getName(), file);
}
Aggregations